mazegame
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v7View latest version
A turn-based strategy game where you compete against an AI monster to collect coins on a grid-based map.
- Objective: Collect as many coins as possible before the monster does
- Controls: Use arrow keys (↑↓←→) to move your character
- Game Flow:
- You move first using arrow keys
- After each of your moves, the monster automatically moves
- The game ends when all 5 coins are collected
- Winner is determined by who collected the most coins
- 10x10 grid with randomly placed walls (20% of tiles)
- Ensures there's always a path between player and monster starting positions
- Player starts in top-left corner (👤)
- Monster starts in bottom-right corner (👹)
- Uses Dijkstra's algorithm to find the shortest path to the nearest coin
- Moves optimally toward coins, making strategic decisions
- Will compete directly with the player for coin collection
- Player: 👤 (blue)
- Monster: 👹 (red)
- Coins: 🪙 (gold)
- Floor tiles: Light gray
- Wall tiles: Dark gray
- Score tracking: Real-time display of player score, monster score, and remaining coins
- Turn-based movement (player moves, then monster moves)
- Collision detection with walls
- Automatic coin collection when stepping on coin tiles
- Game over screen with final scores and winner announcement
- "New Game" button to restart with a fresh randomly generated map
- Frontend: Vanilla JavaScript with HTML5 and CSS3
- Styling: TailwindCSS for responsive design
- Pathfinding: Dijkstra's algorithm for monster AI
- Grid Generation: Procedural generation with connectivity validation
- Game State: Complete turn-based game loop with win/lose conditions
- ↑ Arrow Up: Move player up
- ↓ Arrow Down: Move player down
- ← Arrow Left: Move player left
- → Arrow Right: Move player right
- New Game Button: Start a new game with fresh map and reset scores
Enjoy the challenge of outsmarting the AI monster!
