Define: collision.pde

  • all the objects and resources you will use in the program (images, user sprite, ‘bots, background images, sounds, etc.)

Objects and Resources Program Will Use:

  • Spaceship
  • Attack Bot
  • Background Music
  • Spaceship Sound
  • Attack Bot Sound
  • Point System
  • Collision Sound
  • Collision Triggered Point Incrementation
  • all the different variables that each object will need for your program (List and explain each variable under its object.)

Different Variables Each Object Will Need:

  • Spaceship
    • Variable(s): spaceship, spaceshipAcc, spaceshipNoAcc, spaceshipX, spaceshipY, spaceshipAng, spaceshipRot, thrust, slow, speedVar
    • Explanation(s): The variable spaceship is a variable of type PImage, which will hold the two different states of the spaceship image. The variable spaceshipAcc is a variable of type PImage, which will hold the image of the spaceship with flames coming from it’s engines, which will replace the variable spaceship, when thrust equals true. The variable spaceshipNoAcc is a variable of type PImage, which will hold the image of the spaceship, which is used to then reset the image of the spaceship back to the one without any flames from it’s engine, for times when thrust equals false, or slow equals true. The varialbe spaceshipX is a variable of type float, and is set to the X position of the spaceship. The variable spaceshipY is a variable of type float, and is set to the Y position of the spaceship. The variable spaceshipAng is a variable of type float, which is set to the angle that spaceship is currently at. The variable spaceshipRot s a variable of type float, which is used to determine how much the spaceship will rotate, ultimately causing the variable spaceshipAng to change. The variable thrust is a variable of type boolean, and is used to trigger the swapping of spaceship images from the one without flames, to the one with flames when it equals true, and vise versa when thrust equals false. The variable slow is a variable of type boolean, and is used to trigger the swapping of spaceship images from the one with flames to the one without flames when it equals true, and also causes the spaceship to slow down and reverse when it’s true. When the slow variable equals false, then the image of the spaceship will default to the one without flames, given that the variable thrust also equals false. The variable speedVar is a variable of type float, and is used to determine how fast the spaceship will fly. The higher the number, the faster the spaceship will go. When the variable is to any decimal between 0 and 1, the spaceship will fly slower, while any negative number will result in the inversion of the controls. When speedVar is set to 0, the spaceship will not move at all.
  • Attack Bot
  • Background Music
  • Spaceship Sound
  • Attack Bot Sound
  • Point System
  • Collision Sound
  • Collision Triggered Point Incrementation
Advertisements

Sound

Commented Code Used To Make Looped Background Sound:

The difficult part for me was getting used to using audacity since it was the first time I used audacity, but once I figured out how to use audacity, it was pretty easy getting the sound to loop using the SoundFile class in processing.

Commented Code For Sound Effects:

I think a sound loop is tougher to add not because of the coding, but because of the sound editing that you would have to do so that the sound doesn’t end up sounding weird when it loops.

The Unit Circle

One thing that makes sense to me about sine is that as the angle starts to increase from 0 to 90 degrees, the sine starts to increase from 0 to 1. As the angle continues to increase from 90 degrees to 180 degrees, the sine starts to decrease from 1 back to 0. The angle continues to increase from 180 degrees to 270 degrees, the sine decreases from 0 to -1. Finally, as the angle increases from 270 degrees to 360 degrees, the sine increases from -1 back to 0.

Image Of Sine:

One thing that makes sense to me about cosine is that as the angle starts to increase from 0 to 90 degrees, the cosine decreases from 1 to 0. As the angle continues to increase from 90 degrees to 180 degrees, the cosine continues to decrease from 0 to -1.  The angle continues to increase from 180 degrees to 270 degrees, the cosine increases from -1 to 0. Finally, as the angle increases from 270 to 360 degrees, the cosine increases from 0 back to 1.

    Image Of Cosine:

Angles have to do with sine and cosine since it determins both sine and cosine. For example, an angle at 90 degrees would have the sine 1 and cosine 0, however an angle at 180 degrees would have the sine of 0 and cosine of -1.

The unit circle is a circle that has a radius of 1 unit, and is used to hlep determin sine and cosine of an point within that one unit. This is useful so that a point travles the same distance diagonally as well as vertacally and horozontally.

The sine of an angle tells me the amount that my image in my buttonFly.pde program has to move vertically so that it does not end up traveling a larger distance when moving diagonally.

The cosine of an angle tells me the amount that my image in my buttonFly.pde program has to move horozontally so that it does not end up traveling a larger distance when moving diagonally.

Deliver: buttonFly.pde

Things That I will Create To Finish Game:

  • In order to finish the game, I think I would like to add a target system where you need to shoot a target which would teleport to a random position after you have successfully shot it.

Important Code For Image Swapping:

Develop: buttonFly.pde

Image Movement Code:

Acceleration Control Code:

 

Edge To Edge Teleportation Code:

Why The Movement Code Needs TO Be So Complicated:

I think the movement code needs to be so complicated is due to the fact that without accounting for the cos and sin of the spaceship, then the horizontal movement o the spaceship will result in the spaceship moving further than the spaceship would if it would move paralled to the x or y axis.

Deliver: myGame.pde

Something that I can add to help finalize the game would be to implement a score keeping system, where the first paddle (either the player or the A.I.) that would reach a certain score would win. Also, something else that I can add would be a visual effect that would show up when the ball hits either one of the paddles. A start screen with options for difficulty could also be implemented to better finish and polish off the game.