INQ241A
Mobile Apps

Activity 8

Touch Input

  1. Modify the bouncing ball script by adding a rectangle sprite that is controlled by the user’s touch. The rectangle sprite should be wider than it is tall and should initially be located at the bottom-center of the screen. The sprite’s y position should never change from its initial value. The sprite’s x position, however, should be set to the x coordinate of the user’s touch.

  2. Modify the script to make the rectangle sprite and the bouncing sprite interact. Use the sprite→overlaps with function inside the add on every frame inline-function to test if the two sprites are overlapping. Note, do not use the sprite→overlap with function. When the two sprites are overlapping, change the bouncing sprite’s speed as if it hit the bottom of the screen.

  3. Modify the script so that if the ball reaches the bottom of the screen, the game is over. Use the game→end function to end the game.

Submission

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