Spaces:
Sleeping
Sleeping
| // Game type definitions | |
| export interface Position { | |
| x: number; | |
| y: number; | |
| } | |
| export interface Velocity { | |
| vx: number; | |
| vy: number; | |
| } | |
| export interface Dimensions { | |
| width: number; | |
| height: number; | |
| } | |
| export interface GameObject extends Position, Dimensions { | |
| type: string; | |
| } | |
| export interface PlayerState extends Position, Velocity, Dimensions { | |
| isJumping: boolean; | |
| isFalling: boolean; | |
| facingRight: boolean; | |
| isAlive: boolean; | |
| score: number; | |
| coins: number; | |
| } | |
| export interface Enemy extends Position, Velocity, Dimensions { | |
| type: 'goomba' | 'koopa'; | |
| isAlive: boolean; | |
| direction: number; | |
| } | |
| export interface Block extends Position, Dimensions { | |
| type: 'ground' | 'brick' | 'question' | 'pipe' | 'coin'; | |
| hasCoin?: boolean; | |
| isHit?: boolean; | |
| } | |
| export interface Level { | |
| width: number; | |
| height: number; | |
| blocks: Block[]; | |
| enemies: Enemy[]; | |
| startPosition: Position; | |
| flagPosition: Position; | |
| } | |
| export interface GameState { | |
| player: PlayerState; | |
| enemies: Enemy[]; | |
| blocks: Block[]; | |
| camera: Position; | |
| isRunning: boolean; | |
| isGameOver: boolean; | |
| isWin: boolean; | |
| level: Level; | |
| } | |
| export interface KeyState { | |
| left: boolean; | |
| right: boolean; | |
| jump: boolean; | |
| } | |