UNPKG

@rpgjs/physic

Version:

A deterministic 2D top-down physics library for RPG, sandbox and MMO games

33 lines 987 B
import { MovementBody, MovementStrategy } from '../MovementStrategy'; /** * Applies a burst of velocity during a fixed duration. * * The dash sets a constant velocity along a direction, then stops the entity * once the duration has elapsed. * * @example * ```typescript * movementManager.add(player, new Dash(8, { x: 1, y: 0 }, 0.15)); * ``` */ export declare class Dash implements MovementStrategy { private readonly speed; private readonly duration; private elapsed; private readonly direction; private finished; /** * Creates a dash movement. * * @param speed - Movement speed in units per second * @param direction - Direction vector (will be normalized) * @param duration - Duration in seconds */ constructor(speed: number, direction: { x: number; y: number; }, duration: number); update(body: MovementBody, dt: number): void; isFinished(): boolean; } //# sourceMappingURL=Dash.d.ts.map