UNPKG

react-ts-asteroids

Version:
26 lines (25 loc) 625 B
import { Point, GameObject, GameState, CreateObject } from './types'; interface ShipArgs { position: Point; create: CreateObject; onDie: () => void; } export default class Ship implements GameObject { position: Point; velocity: Point; rotation: number; rotationSpeed: number; speed: number; inertia: number; radius: number; lastShot: number; create: CreateObject; onDie: () => void; delete?: boolean; constructor(args: ShipArgs); destroy(): void; rotate(dir: 'LEFT' | 'RIGHT'): void; accelerate(): void; render(state: GameState): void; } export {};