A fun 2D platformer game built with HTML5 Canvas and vanilla JavaScript, featuring Pranush as the heroic character!
- Open
index.htmlin your web browser - Use Arrow Keys or WASD to move left and right
- Press Space to jump
- Press P to pause the game
- Click the 🔊 button in the top-right to toggle sound effects
- Open the game in your mobile browser
- Use the ◀ ▶ buttons at the bottom-left to move left and right
- Tap the JUMP button at the bottom-right to jump
- Touch controls automatically appear on mobile devices
- Collect coins for points
- Stomp on enemies by jumping on them
- Grab power-ups to grow bigger and stronger
- Reach the green flag to complete each level!
To use your friend's picture as the game character, follow these steps:
- Take or select a clear photo of your friend
- Use an online tool like remove.bg to remove the background
- Download the PNG file with transparent background
- Resize it to 64x64 or 128x128 pixels using:
- Save the file as
player.pngin theassets/images/folder
If you can't remove the background:
- Crop the image to a square (same width and height)
- Resize to 64x64 or 128x128 pixels
- Save as
player.pngin theassets/images/folder - The game will display it with a white/colored border
- Format: PNG (preferred for transparency)
- Size: 64x64 or 128x128 pixels
- Location:
assets/images/player.png - Transparency: Optional but looks better
After adding the image:
- Refresh your browser (Ctrl+F5 or Cmd+Shift+R)
- Start a new game
- You should see your custom character!
If the image doesn't load, the game will show a default red character instead.
- Level 1: Tutorial level - Learn the basics
- Level 2: Intermediate - Moving platforms and more enemies
- Level 3: Advanced - Complex platforming challenges
- Platforms: Solid and moving platforms
- Enemies:
- Walkers: Patrol back and forth on platforms
- Flyers: Fly in wave patterns
- Collectibles:
- Coins: Worth 10 points each
- Power-ups: Grow bigger, worth 100 points
- Lives System: Start with 3 lives
- Scoring: Collect coins and defeat enemies for points
- Character grows bigger
- Lasts for 10 seconds
- Taking damage while powered up removes the power-up instead of a life
- Jump: Upward sweep sound when jumping
- Coin Collect: Pleasant "ding" when collecting coins
- Power-up: Ascending arpeggio when grabbing power-ups
- Enemy Stomp: Low thump when defeating enemies
- Damage: Harsh sound when taking damage
- Level Complete: Victory fanfare (3 notes)
- Game Over: Descending sad melody
- Toggle: Click the 🔊 button in the HUD to mute/unmute
blackhole/
├── index.html # Main game file
├── css/
│ └── style.css # Game styling
├── js/
│ ├── game.js # Main game loop
│ ├── player.js # Player character
│ ├── platform.js # Platform objects
│ ├── enemy.js # Enemy AI
│ ├── collectible.js # Coins and power-ups
│ ├── level.js # Level management
│ ├── physics.js # Physics engine
│ ├── input.js # Keyboard controls
│ └── utils.js # Helper functions
├── assets/
│ └── images/
│ └── player.png # ← PUT YOUR FRIEND'S IMAGE HERE!
└── levels/
├── level1.js # Level 1 data
├── level2.js # Level 2 data
└── level3.js # Level 3 data
- Stomping Enemies: Jump on top of enemies to defeat them (50 points)
- Moving Platforms: Time your jumps carefully
- Power-ups: Use power-ups strategically for tough enemy sections
- Invincibility: After taking damage, you get 2 seconds of invincibility (blinking effect)
- Falling: Don't fall off the bottom of the screen!
Want to modify the game? Here are some easy tweaks:
Edit js/physics.js:
- Increase
GRAVITYfor harder jumping - Increase
JUMP_VELOCITYfor higher jumps - Adjust
MOVE_SPEEDfor faster/slower movement
Edit css/style.css to change menu colors and backgrounds
Copy one of the level files in levels/ and modify the platform positions, enemies, and collectibles!
Edit js/player.js and change this.width and this.height in the constructor
Character image not showing?
- Check that the file is named exactly
player.png - Make sure it's in the
assets/images/folder - Try hard-refreshing the browser (Ctrl+F5)
- Check browser console (F12) for errors
Game not starting?
- Make sure JavaScript is enabled in your browser
- Open browser console (F12) to check for errors
- Try a different browser (Chrome, Firefox, Safari, Edge)
Performance issues?
- Close other browser tabs
- Try a modern browser
- The game runs at 60 FPS on most devices
Built with vanilla JavaScript and HTML5 Canvas - no frameworks required!
Enjoy your custom Mario-like platformer! 🎮