Goal:
Now that all our game over and restart code is done, lets go ahead and create some controls for our game.
We are going to use tilt/motion controls to make pikachu move on the screen. By tilting the phone one way or the other we are going to make the image slide around on the screen and try avoid the pokeball.
Steps:
- From AccelerometerSensor, place an AccelerationChange block.
- From Pikachu, place a MoveTo block inside of the AccelerationChange block.
- From Math, attach a -(minus) block to the x slot of the MoveTo block.
- From Pikachu, place a Pikachu.X block in the left side of the -(minus) block.
- From the AccelerationChange block, hover over the orange xAccel circle, then grab the get xAccel block and place it in the right side of the -(minus) block.
- From Math, attach a +(plus) block to the y slot in the MoveTo block.
- From Pikachu, place a Pikachu.Y block into the left side of the +(plus) block.
- From the AccelerationChange block, hover over the orange yAccel circle, then grab the get yAccel block and place it in the right side of the +(plus) block.