Difference between revisions of "Asteroids"
From WLCS
Line 10: | Line 10: | ||
=== Ship Movement === | === Ship Movement === | ||
* The ship should always point towards the mouse | * The ship should always point towards the mouse | ||
− | * Pressing the W-key will accelerate the ship | + | * Pressing the W-key will accelerate the ship and go forwards |
− | * Pressing the S-key will decelerate the ship | + | *# Create a '''speed''' variable and set it to 0 |
+ | *# If the W-key is pressed, then increase '''speed''' by a little bit (e.g. 0.5) | ||
+ | *# Else, if speed is greater than 0, then decrease '''speed''' by a little bit (e.g. -0.5) | ||
+ | *# Move the ship '''speed''' steps | ||
+ | * Pressing the S-key will decelerate the ship and go backwards | ||
+ | ** Follow the same steps as the W-key, but reverse/negate everything | ||
=== Firing Projectiles === | === Firing Projectiles === | ||
− | * Pressing the mouse down will fire a projectile | + | * Pressing the mouse down will fire a projectile (use clones) |
** The projectile should disappear when it hits the edge of the screen | ** The projectile should disappear when it hits the edge of the screen | ||
− | ** If the mouse is held down, | + | ** If the mouse is held down, a projectiles (clones) should be fired every 0.5 second |
− | + | === Asteroids === | |
+ | # Make an asteroid appear at a random edge of the screen | ||
+ | ## Pick a random number between 1-4 (each number corresponds to a side) | ||
+ | ## Pick a random place for that side and tell the asteroid to appear there | ||
+ | ## Give it a random direction (these will depend on which side the asteroid is located | ||
+ | # Have it move across the screen |
Revision as of 09:57, 30 May 2013
Objectives
- You will create a game that mimics gameplay of Asteroids
- The player will be able to move around using the keyboard
- The player's ship will be affected by momentum and physics
- The player will be able to fire at asteroids and break them apart
- The player will be able to aim using the mouse
- Points will be given to the player for destroying asteroids
Requirements
Ship Movement
- The ship should always point towards the mouse
- Pressing the W-key will accelerate the ship and go forwards
- Create a speed variable and set it to 0
- If the W-key is pressed, then increase speed by a little bit (e.g. 0.5)
- Else, if speed is greater than 0, then decrease speed by a little bit (e.g. -0.5)
- Move the ship speed steps
- Pressing the S-key will decelerate the ship and go backwards
- Follow the same steps as the W-key, but reverse/negate everything
Firing Projectiles
- Pressing the mouse down will fire a projectile (use clones)
- The projectile should disappear when it hits the edge of the screen
- If the mouse is held down, a projectiles (clones) should be fired every 0.5 second
Asteroids
- Make an asteroid appear at a random edge of the screen
- Pick a random number between 1-4 (each number corresponds to a side)
- Pick a random place for that side and tell the asteroid to appear there
- Give it a random direction (these will depend on which side the asteroid is located
- Have it move across the screen