Review: Asteroid Blaster
Create your own asteroid destroying masterpiece.

Student Task #1: Create the Spaceship
Create a spaceship for the player to control
- Create a sprite, with the image set to a spaceship. Store it in the variable
||variables:spaceship|| - Add a
||controller:move spaceship with buttons||block, and set both||controller:vx||and||controller:vy||to 50 ||sprites:Change||||variables:spaceship||s||sprites:y||position by 40, to move them closer to the bottom of the screen- Use
||info:set life to 3||to start the player off with some life - Use
||info:set score to 0||to start the player off with no score
Student Task #2: Firing Lasers
Add the ability for the player to fire lasers
- Create an
||controller:on A button pressed||event - In the event, create a
||sprites:projectile from spaceship||with a||sprites:vx||of 0 and a||sprites:vy||of -100 - Change the image of each
||sprites:projectile||image to be a laser - a one or two pixel line is enough - Set the kind of each
||sprites:projectile||kind toLaser - Set the
||sprites:z||value for the||sprites:projectile||to be -1, so that it appears below the ship
Student Task #3: Evil Asteroids
Add asteroids for the player to avoid, that are created more quickly as time goes on
- Create a
||loops:forever||loop - Inside the
||loops:forever||loop, create a||sprites:projectile from side||with an image of an asteroid and change both the||sprites:vx||and||sprites:vy||to||math:random||values between -50 and 50 - Set it to be of
||sprites:kind|Asteroid - After creating the
Asteroid, use||loops:pause||to pause for2000 - (30 x||info:score||)ms. As the player scores more points, the time between asteroids being created decreases
Student Task #4: Damage
Add an event so that the player loses life
- Add an event for when a sprite of kind
Playeroverlaps with a sprite of kindAsteroid - Decrease
||info:life||by 1 ||sprites:destroy||theAsteroidsprite
Student Task #5: Laser Effect
Give the laser some power to destroy the asteroids
- Add an event for when a sprite of kind
Laseroverlaps with a sprite of kindAsteroid - Increase the player’s score by one
||sprites:destroy||both theAsteroidandLasersprites involved in the overlap
Challenges
Currently, the game gets nearly impossible to progress past 67 or so points; at that point, the ||loops:pause|| will do nothing, as 2000 - 30 * 67 is less than 0. To fix this, use ||math:max|| in the ||loops:pause||, to choose the maximum (largest) value between the current equation, and 500.