feat: Add player entity with WASD/space controls and spawn functionality

This commit is contained in:
Kacper Kostka (aider)
2025-04-05 18:03:10 +02:00
parent d86baa8f99
commit db5b49ee7f
6 changed files with 274 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
// Base entity system
const ENTITY_TYPES = {
RABBIT: 'rabbit'
RABBIT: 'rabbit',
PLAYER: 'player'
};
// Store all entities
@@ -141,6 +142,9 @@ function createEntity(type, x, y, options = {}) {
case ENTITY_TYPES.RABBIT:
entity = new Rabbit(x, y, options);
break;
case ENTITY_TYPES.PLAYER:
entity = new Player(x, y, options);
break;
default:
console.error(`Unknown entity type: ${type}`);
return null;