feat: implement ECS architecture with game entity management
- Introduced a new Entity-Component-System (ECS) architecture for the game. - Created foundational components such as Transform, Velocity, Health, and Collidable. - Developed systems for handling input, movement, collision detection, and rendering. - Added game logic for player control, coin collection, and obstacle interactions. - Implemented a performance monitor for real-time metrics display. - Enhanced game initialization and entity creation processes. This update significantly refactors the game structure, improving maintainability and scalability.
This commit is contained in:
parent
50544989ca
commit
7dd7477a3b
20 changed files with 1610 additions and 616 deletions
18
src/main.js
Normal file
18
src/main.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { Game } from './game/Game.js';
|
||||
|
||||
// Start the game immediately (script is at end of body, DOM is ready)
|
||||
console.log('Starting 3D Coin Collector Game with ECS Architecture');
|
||||
console.log('Press "T" to toggle performance monitor (or shake device on mobile)');
|
||||
|
||||
// Wait a tick to ensure everything is loaded
|
||||
setTimeout(() => {
|
||||
try {
|
||||
const game = new Game();
|
||||
|
||||
// Make game accessible from console for debugging
|
||||
window.game = game;
|
||||
} catch (error) {
|
||||
console.error('Game initialization failed:', error);
|
||||
}
|
||||
}, 0);
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue