Accelerometers for Asteroids
This activity was created by Sean Stern of the NYC Academy for Software Engineering.
In this project, you will use the accelerometer to control a spaceship in the game Asteroids. The game starts when you click the green flag. Asteroids come from the top of the screen and move down. The player should try to avoid the asteroids by moving the ship using the Finch.
Part 1: The Rules of the Game
In order to control the ship, we’re going to be using the accelerometer on the Finch.
Fill out Table 1 WITH YOUR TEACHER as a first step towards understanding how to do this. All the tables for this activity are in AccelerometersAsteroidsPlanningDocument.pdf.
Part 2: Build the Controller
You will start by importing AsteroidsStarter.xml (Snap!) or AsteroidsStarter.sb2 (Scratch). Every block you need is already present. Your goal is to arrange them correctly so that the ship can move properly. As you complete this section, fill out Table 2 in the planning document.
Part 3: Detect Collisions
For this part of the activity, you’ll try to detect collisions between
- the ship and the asteroid
- the ship and the health containers
Your program will need to make a decision using a boolean block. See if you can ADD code that will perform the tasks in Table 3. As you work, remember to fill out this table.