@rpgjs/physic
Version:
A deterministic 2D top-down physics library for RPG, sandbox and MMO games
36 lines • 1.17 kB
TypeScript
import { MovementBody, MovementStrategy } from '../MovementStrategy';
/**
* Aggregates multiple strategies either in parallel or in sequence.
*
* Parallel mode applies all strategies on the same frame; sequence mode runs
* them one after another.
*
* @example
* ```typescript
* const composite = new CompositeMovement('parallel', [
* new LinearMove({ x: 2, y: 0 }),
* new Oscillate({ x: 0, y: 1 }, 1, 2),
* ]);
* movementManager.add(entity, composite);
* ```
*/
export declare class CompositeMovement implements MovementStrategy {
private readonly mode;
private readonly strategies;
private currentIndex;
/**
* Creates a composite movement.
*
* @param mode - Parallel or sequence execution
* @param strategies - Strategies to aggregate
*/
constructor(mode: 'parallel' | 'sequence', strategies: MovementStrategy[]);
update(body: MovementBody, dt: number): void;
isFinished(): boolean;
add(strategy: MovementStrategy): void;
remove(strategy: MovementStrategy): boolean;
reset(): void;
private updateParallel;
private updateSequence;
}
//# sourceMappingURL=CompositeMovement.d.ts.map