JIT
Fun Dinosaur Game with Effects and Long Playtime
Create A fun game like the dinosaur game that incentivises the player to play for a long time. Add a lot of fun effects and particles. Make it look good.

Okay, let's create a fun endless runner game with cool effects! We'll use HTML for the structure, CSS for styling, and JavaScript for the game logic and effects.

This sets up the basic structure and logic for the endless runner game.

  1. HTML (index.html): Contains the canvas, score displays, and screens for starting and game over.
  2. CSS (style.css): Styles the elements, centers the game, and provides basic button styling.
  3. JavaScript (script.js):
    • Defines Player, Obstacle, and Particle classes.
    • Sets up the game loop (requestAnimationFrame).
    • Handles player jumping, gravity, and ground detection.
    • Spawns obstacles randomly with varying sizes and colors.
    • Detects collisions between the player and obstacles.
    • Manages score and high score (using localStorage).
    • Gradually increases game speed.
    • Includes particle effects for jumping, landing, and crashing.
    • Adds a dynamic gradient background that changes color over time.
    • Handles game start and game over states.
    • Listens for keyboard (Space/ArrowUp) and touch events for jumping and starting/restarting.

You can now run this code. Press the "Start Game" button or Spacebar/Tap to begin playing. Jump over the obstacles and try to get a high score!*

Updated files
v1
Add microtransactions and a gun to the game.

Okay, let's add a simulated microtransaction system to acquire a gun and the ability to shoot obstacles.

We'll introduce:

  1. Coins: Earned during gameplay.
  2. A Shop: To buy the gun using coins.
  3. Shooting Mechanic: Press a key to fire bullets.
  4. Simulated "Buy Coins" Button: To add coins instantly (no real money involved).

Now the game includes:

  • Coins: Yellow circles appear periodically. Collect them by running into them. Your coin total is saved.
  • Shop: Accessible from the start and game over screens. You can buy a gun (one-time purchase) and ammo (if you own the gun).
  • Gun: If purchased, press 'F' or tap the 'Shoot' button (bottom right) to fire bullets. Bullets destroy obstacles and give bonus points. Ammo is limited.
  • Simulated Microtransactions: Buttons labeled "Get 100 Coins (Simulated)" are added to the start, game over, and shop screens. Clicking them instantly adds 100 coins (no real payment).
  • UI Updates: Displays coins and ammo (if the gun is owned). Shop buttons enable/disable based on funds and ownership.
  • Persistence: Your coin count, high score, gun ownership, and ammo are saved in localStorage between sessions.
Updated files
v2