A modern web-based Pokemon-inspired battle game built with TypeScript, Phaser 3, and WebSocket technology. Experience turn-based battles, Pokemon switching, and real-time multiplayer combat in your browser!
Experience epic Pokemon battles with smooth animations and responsive UI
- Turn-based Combat: Strategic Pokemon battles with move selection
- Real-time Multiplayer: Challenge other players in PvP battles
- Wild Pokemon Encounters: Battle wild Pokemon in single-player mode
- Dynamic Pokemon Switching: Switch between team members during battle
- Status Effects: Paralysis, poison, burn, freeze, and sleep mechanics
- Type Effectiveness: Super effective, not very effective, and immunity systems
- Critical Hits: Random critical hit mechanics for extra damage
- Responsive Battle UI: Clean, Pokemon-inspired interface
- HP Bars with Animations: Smooth health animations with color indicators
- Pokemon Information Display: Name, level, HP, and status clearly shown
- Move Selection: Interactive move buttons with descriptions
- Item Usage: Bag system for using healing items and Pokeballs
- Battle Messages: Real-time event messages and battle commentary
- WebSocket Communication: Real-time battle synchronization
- PvP Battle System: Challenge friends in online battles
- Event Processing: Comprehensive battle event handling
- Turn Management: Synchronized turn-based gameplay
- Dynamic Music: Different tracks for wild battles and PvP battles
- Pokemon Sprites: Full collection of Pokemon front and back sprites
- Battle Animations: Smooth sprite animations and effects
- Battle Backgrounds: Immersive battle environments
- Node.js (v16 or higher)
- npm or yarn package manager
First, start the server: milan090/pokemonlegends-backend
-
Install dependencies
npm install
-
Start the development server
npm run dev
-
Open your browser Navigate to
http://localhost:3000to start playing!
- Encounter a wild Pokemon in the game world
- Choose from four actions: Fight, Bag, Pokemon, or Run
- Select moves to attack or use items from your bag
- Switch Pokemon when needed or try to capture wild Pokemon
- Win by defeating the wild Pokemon or run away to escape
- Challenge another player to a battle
- Take turns selecting moves for your Pokemon
- Use strategy to switch Pokemon and counter opponent moves
- First player to defeat all opponent Pokemon wins!
- Mouse/Touch: Click buttons to select actions and moves
- Hover: Hover over moves to see descriptions and stats
- Keyboard: Some shortcuts available for quick actions
- TypeScript: Type-safe JavaScript for robust development
- Phaser 3: Powerful 2D game framework for rendering and physics
- WebSocket: Real-time communication for multiplayer features
- CSS3: Modern styling with animations and responsive design
src/
โโโ managers/
โ โโโ battle/ # Battle system management
โ โ โโโ BattleManager.ts
โ โ โโโ BattleUIManager.ts
โ โ โโโ BattleEventProcessor.ts
โ โ โโโ BattleAnimationManager.ts
โ โโโ ...
โโโ scenes/ # Phaser game scenes
โโโ services/ # WebSocket and API services
โโโ types/ # TypeScript type definitions
โโโ utils/ # Utility functions and helpers
โโโ assets/ # Game assets (sprites, audio, etc.)
- Orchestrates the entire battle flow
- Manages turn-based combat logic
- Handles both PvP and wild Pokemon battles
- Coordinates UI updates and animations
- Processes real-time battle events from the server
- Handles move animations, damage calculation, and status effects
- Manages Pokemon switching and battle state changes
- Synchronizes multiplayer battle events
- Creates and manages battle interface elements
- Handles user interactions and button states
- Updates Pokemon information displays
- Manages responsive design and animations
The game uses a comprehensive event system to handle battle mechanics:
move_used: When a Pokemon uses a movedamage_dealt: Health reduction with effectiveness calculationheal: HP restoration eventsstatus_applied: Status effect application (poison, paralysis, etc.)pokemon_fainted: When a Pokemon's HP reaches zeroswitch_in: Pokemon switching with full stat updatespokemon_switched: Confirmation of successful switchesturn_start: Beginning of each battle turngeneric_message: Battle commentary and messages
- Event Processing Delay: 1500ms between battle events
- HP Animation Speed: Smooth health bar transitions
- Auto-save: Battle state automatically saved
- Music Transitions: Seamless audio switching
- Responsive design works on desktop and mobile
- Pokemon sprite fallbacks for missing assets
- Color-coded HP bars (green โ yellow โ red)
- Status effect color indicators
- Front Sprites: Used for opponent/wild Pokemon
- Back Sprites: Used for player Pokemon
- Icon Sprites: Fallback images and team displays
- Format: PNG images with transparent backgrounds
- Wild Battle Music: Intense battle themes
- PvP Battle Music: Competitive multiplayer tracks
- Normal Music: Overworld and menu themes
- Sound Effects: Move sounds, button clicks, etc.
Battle UI not responding
- Check WebSocket connection status
- Ensure all battle events are processed
- Verify Pokemon data is loaded correctly
Sprites not loading
- Check asset paths in
/public/assets/Sprites/ - Verify image file formats (PNG recommended)
- Check browser console for 404 errors
Multiplayer sync issues
- Confirm WebSocket server is running
- Check network connectivity
- Verify player IDs are correctly assigned
We welcome contributions! Please follow these guidelines:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Pokemon Company: Inspiration for game mechanics and design
- Phaser Community: Amazing game development framework
- TypeScript Team: Excellent typing system for large projects
- Contributors: All developers who helped build this game
