INQ241B
Mobile Apps

Activity 7

Events

  1. Modify your script from last class 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. Also remove the if statement that bounces the sprite when it hits the bottom of the screen.

Submission

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