Discover: collision.pde

Backstory of the game:

You are an astronaut that is currently on a mission to Mars. However, your spaceship can’t hold enough fuel for the entire trip to Mars, so you need to make a refueling stop. You need to align the spaceship with the dock, which you will then dock and refuel.

Description of Game:

You will be controlling a spaceship with the WASD keys. There will be a black circle that is around your spaceship. Keep the spaceship within the circle! If your spaceship leaves the circle, then you will see the score on the upper left side of the screen start to rapidly go down from 50. If the score hits 0, then you will have lost the game. You have misaligned the spaceship with the dock and as a result, have crashed.

Images I will reuse from buttonfly.pde:

Images I will use in game:

How to successfully win the game:

The game will end after you have successfully docked the spaceship 3 times.

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.

 

Develop: myGame.pde

This code is better because the old code just made the ball bounce back up without changing direction. This means that the ball would just bounce back and forth on one x position. After the new code is put in, this causes not only for the ball to change x positions, but also speeds up the rate at which the ball travels.