Add new p5.js example: Survive the Horde
Description
This PR adds a new example game named "Survive the Horde" under examples/javascript_game/.
It demonstrates player movement, shooting, enemy spawning, and collision detection using p5.js.
Changes
- Added new folder
examples/javascript_game/-
index.html: main entry point -
game.js: core game logic -
game.css: styles for layout and dark theme -
README.md: game description and instructions
-
- The game shows how to use animation loops, keyboard input, and object interaction in p5.js.
How to Play
- Use Arrow Keys to move the player.
- Press Spacebar to shoot bullets in four directions.
- Survive as long as possible while avoiding incoming enemies.
- Getting hit by an enemy ends the game.
Screenshot
PR Checklist
- [x] Example runs without errors
- [x] Includes a
README.mdwith description and controls - [x] Tested locally using
Live Server
Additional Notes
This example demonstrates:
- Collision detection
- Simple scoring system
- Dynamic enemy spawning
- Real-time user interaction using p5.js
🎉 Thanks for opening this pull request! For guidance on contributing, check out our contributor guidelines and other resources for contributors! 🤔 Please ensure that your PR links to an issue, which has been approved for work by a maintainer; otherwise, there might already be someone working on it, or still ongoing discussion about implementation. You are welcome to join the discussion in an Issue if you're not sure! 🌸 Once your PR is merged, be sure to add yourself to the list of contributors on the readme page !
Thank You!
Hi! 👋
Linking this PR to the related issue.
Closes #8256
Hi p5.js team,
I’m interested in contributing to the new example game "Survive the Horde" (issue #8256, PR #8248)—or similar interactive projects for the p5.js examples directory.
My background:
- Experience building interactive JS games (with p5.js & canvas).
- Focused on writing clear game logic and accessible code for beginners.
- Passionate about creative coding and making open source fun and welcoming for all.
If there are any improvements, extensions, or additional example slots available, I’d love to help. Please consider assigning me to ongoing or related tasks—especially those involving new examples, accessibility, or education.
Thanks for your consideration!