DESIGN: collision.pde

Link to Aziza’s design blog post 

Advertisements

DEFINE: collision.pde

*For the discover post for this project go to Aziza’s blog * 

Aziza and I will be using different objects and resources for our game which will include the following

  • User star
    • User star name (uStar)
    • X and Y position variables (starX, starY)
    • Rotation (sine and cosine needed to do this) ( starRot)
    • Motion variables (mvSX, mvSY)
    • Speed of star (spdStar)
    • Color of star (starCol)
  • Flower 1
    • pf1
       *PLEASE BE AWARE THAT THE IMAGES WILL NOT BE GIFS IN THE GAME*
    • Image name (F1)
    • X and Y position of image (f1X, f1Y)
    • Rotation of image (f1Rot)
    • Motion variables (mvF1X, mvF1Y)
    • Angle of image (f1Ang)
    • Speed of image (spdF1)
  •  Flower 2
    • pf2
       *PLEASE BE AWARE THAT THE IMAGES WILL NOT BE GIFS IN THE GAME*
    • Image name (F2)
    • X and Y position of image (f2X, f2Y)
    • Rotation of image (f2Rot)
    • Motion variables (mvF2X, mvF2Y)
    • Angle of image (f2Ang)
    • Speed of image (spdF2)
  • Flower 3
    • pf3
    • Image name (F3)
    • X and Y position of image (f3X, f3Y)
    • Rotation of image (f3Rot)
    • Motion variables (mvF3X, mvF3Y)
    • Angle of image (f3Ang)
    • Speed of image (spdF3)

 

Additional Variable(s) that will be needed in our program: 

  • We will be using the arrow keys to control the user star
    • UP, DOWN, LEFT, RIGHT
  • colorBump
    • This will be changing the color by increasing the RGB value.
  • bG
    • Background color for game

 

For the design post for the project check out Aziza’s blog

The Unit Circle

The Unit Circle is a circle with a radius of 1. The unit circle identifies coordinates by using the angles of sine, cosine, and tangent. The image below is an example of the unit circle:
uCc

source

The sine of an angle in a video game tells us that the motion is changing for y axis. So this means that an object when in motion is changing by the y axis.

The cosine of an angle in a video game tells us that the motion is changing for the x axis.

 

unitC

The sine and cosine of an angle helps give the coordinates of an image because they give where the x and y coordinates are.

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.

DESIGN: buttonFly.pde

Rotation for an image needs the following code that is highlighted in yellow:

Screen Shot 2017-11-03 at 12.07.26 PM

Since there is no keyReleased code the rotation on the spirals is going to continue until the game is not running anymore. In the next version (03) I added the keyReleased which stops the rotation if the key is no longer being pressed.

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