DELIVER: buttonFly.pde

To finish off my game I need to swap the images when the key “b” is pressed.

In order to do that I need to add another image to my program and another variable.

Screen Shot 2017-11-03 at 12.40.30 PM.png

Screen Shot 2017-11-03 at 12.41.05 PM.png

Screen Shot 2017-11-03 at 12.41.38 PM.png

 

Advertisements

DEVELOP: buttonFly.pde

a typed out explanation (or guess) of why the movement code needs to be so complicated

In version 4 of my program I added the image movement code by pressing the key “b” – (the movement code is highlighted in yellow):

Screen Shot 2017-11-03 at 12.16.47 PM

Screen Shot 2017-11-03 at 12.17.59 PM

Screen Shot 2017-11-03 at 12.18.27 PM

The reason why the movement code is so complicated because the x and y movement are different. The cosine is how the x motion changed and the sine of y is how the y motion is changed. The spiral now accelerates and moves across the window where it does not come back on the screen.

In version 5 the spiral teleports to the other edge of the screen when it disappears of the screen.

Screen Shot 2017-11-03 at 12.28.30 PM.png

The code highlighted shows how the spiral is able to transport to different edges of the screen when it goes off the screen.