super-mario / lib /constants.ts
asemxin
fix: improve touch controls with pointer capture and better mobile speed
01fc219
// Game constants
export const GAME_CONFIG = {
// Canvas
CANVAS_WIDTH: 800,
CANVAS_HEIGHT: 480,
// Physics
GRAVITY: 0.6,
FRICTION: 0.85,
MAX_FALL_SPEED: 12,
// Player
PLAYER_WIDTH: 32,
PLAYER_HEIGHT: 48,
PLAYER_SPEED: 5,
MOBILE_PLAYER_SPEED: 4.2, // Slightly reduced for mobile but still responsive
PLAYER_JUMP_FORCE: -14,
MOBILE_JUMP_FORCE: -13, // Slightly lower jump for mobile
// Tile size
TILE_SIZE: 32,
// Colors (Mario themed)
COLORS: {
SKY: '#5c94fc',
GROUND: '#c84c0c',
BRICK: '#d89070',
QUESTION: '#ffa500',
PIPE: '#00a800',
COIN: '#ffd700',
MARIO_RED: '#e52521',
MARIO_BLUE: '#049cd8',
MARIO_SKIN: '#ffc0a0',
GOOMBA: '#a0522d',
FLAG: '#00ff00',
},
// Level dimensions
LEVEL_WIDTH: 3200,
LEVEL_HEIGHT: 480,
} as const;
export const KEYS = {
LEFT: ['ArrowLeft', 'KeyA'] as string[],
RIGHT: ['ArrowRight', 'KeyD'] as string[],
JUMP: ['ArrowUp', 'KeyW', 'Space'] as string[],
};