INQ241B
Mobile Apps

Activity 9

Accelerometer Control

In this activity you will create a simple accelerometer controlled chase game. To do so, complete the following steps:

  1. Create a new script that has a sprite that is controlled with the accelerometer. It can be any image and can be any size. Tilting left, right, up, or down should change the sprite’s speed accordingly. It should not be possible for the sprite to move off of the screen.

  2. Add a second sprite to the script. The sprite should have a random initial position and should always be moving away from the user-controlled sprite. The sprite can be any image and be any size. It should not be possible for the sprite to move off of the screen. To move this sprite away from the user-controlled sprite you can use the sprite→speed towards function with a negative speed.

  3. Modify the game so that the two sprites are interactive. When the two sprites overlap, add to the player’s score and move the computer-controlled sprite to a random location.

Submission

Please show your source code and run your scripts for the instructor or lab assistant.