Files
KateLegend2_proj/test_motion.ts
T
2026-06-07 22:10:03 +08:00

16 lines
666 B
TypeScript

import { PlayerMotionModel } from './assets/scripts/logic/PlayerMotionModel';
import { PlayerColorState, MOVE_SPEED } from './assets/scripts/common/Constants';
const m = new PlayerMotionModel({
aabb: { x: 0, y: 16, w: 16, h: 32 },
platforms: [{ topY: 0, leftX: -500, rightX: 500 }],
initialColorState: PlayerColorState.Red,
levelLengthPx: 2000,
});
console.log('after constructor: grounded=', m.isGrounded, 'aabb=', m.aabb, 'vx=', m.vx);
m.update(0.016);
console.log('after settle: grounded=', m.isGrounded, 'aabb=', m.aabb, 'vx=', m.vx, 'vy=', m.vy);
m.setHorizontalInput(1);
m.update(1);
console.log('after move: aabb.x=', m.aabb.x, 'vx=', m.vx);