@rpgjs/physic
Version:
A deterministic 2D top-down physics library for RPG, sandbox and MMO games
31 lines • 976 B
TypeScript
import { MovementBody, MovementStrategy } from '../MovementStrategy';
/**
* Applies a constant velocity to an entity for an optional duration.
*
* The velocity is expressed in world units per second and is assigned directly
* to the entity before each physics step.
*
* @example
* ```typescript
* const move = new LinearMove({ x: 2, y: 0 });
* movementManager.add(entity, move);
* ```
*/
export declare class LinearMove implements MovementStrategy {
private readonly velocity;
private readonly duration?;
private elapsed;
/**
* Creates a linear movement strategy.
*
* @param velocity - Velocity to apply (units per second)
* @param duration - Optional duration in seconds (undefined for infinite)
*/
constructor(velocity: {
x: number;
y: number;
}, duration?: number | undefined);
update(body: MovementBody, dt: number): void;
isFinished(): boolean;
}
//# sourceMappingURL=LinearMove.d.ts.map