Okay, let's create a simple Snake game using HTML, CSS, and JavaScript.
You can now open the index.html
file. Use the arrow keys to control the snake. Eat the red food to grow and increase your score. The game ends if you hit the wall or your own tail.
Okay, let's create a more advanced game: a basic Asteroids clone. This involves physics for movement, rotation, shooting, and collision detection.
This sets up an Asteroids game where you can:
Open index.html
to play.
Okay, let's build a more advanced game: a basic 2D Platformer. This will involve gravity, jumping mechanics, collision detection with platforms, and simple level design.
This creates a platformer with:
Platform
objects.Open index.html
to play. You can move the orange rectangle around and jump on the green and brown platforms.*
Okay, let's create a more advanced Top-Down Shooter game. This will involve player movement controlled by keyboard, aiming/shooting with the mouse, basic enemy AI, health, and scoring.
This Top-Down Shooter includes:
Open index.html
to play. Move with WASD, aim with the mouse, and click to shoot the red enemies.
Okay, let's build a more complex game: a basic Tile-Based Dungeon Crawler. This will involve navigating a map made of tiles, camera scrolling, simple enemies, and collecting items.
This Dungeon Crawler features:
map.js
, easily modifiable.Open index.html
to explore the dungeon! Navigate the corridors, avoid or defeat the red enemies, find the gold key, and reach the exit (initially red, turns green when unlocked).*
Okay, let's create a basic 3D game using Three.js. This will be a simple "collect the spinning cubes" game where you control a sphere in a 3D environment.
Since we are in a browser environment and cannot easily install packages, we'll load Three.js via a CDN.
This sets up a 3D scene where:
Open index.html
to play. Move the sphere to collect all the spinning yellow cubes!*
Okay, let's create a more advanced 3D game using Three.js and incorporating a physics engine (cannon-es
). This will be a simple physics-based shooter where you control a sphere, navigate obstacles, and shoot targets.
We'll load both three
and cannon-es
via CDN using import maps.
This creates a more involved 3D game with:
cannon-es
for realistic movement, gravity, and collisions.cannon-es
contact materials and collision events to detect bullet-target hits and player-ground contact (for jumping).Open index.html
to play. Use WASD to apply force to the blue sphere, Space to jump (when touching the ground), and click to shoot yellow bullets at the red targets. Destroy all targets to win!*
Okay, let's build a Basic Tower Defense game using HTML Canvas and JavaScript. This involves placing towers to defend against waves of enemies moving along a predefined path.
This sets up a Tower Defense game with:
Open index.html
to play. Click the "Basic Tower" button to enter build mode (cursor changes), then click on a valid green square to place a tower. Click "Start Next Wave" to begin the onslaught!*