[XoL]
2015-02-06 00:00:23
JAVA
——
GOAL: Your game should contain a rectangular space ship that can move up, down, left, or right. The movement is controlled by the arrow keys and corresponds to "thrusters" that accelerate when firing, coast when not. This means you need to fire the opposing thruster to stop your ship. When an arrow key is pressed, it should adjust the appropriate component of the velocity and set the other component to zero.
There should be an array of five rocks moving about the screen with (randomly chosen) fixed velocity vectors. When a rock is hit by the cannonball, it should vanish (and be gone from the game). If you destroy all the rocks, you've won. If a rock runs into your ship, you've lost.
When the cannonball is fired, it moves off to the right of the ship at a fixed speed. After a while, the ball disappears.
Objects that move off one edge of the screen should come back in on the opposite edge (wrap-around effect).
You'll need to check for collisions between the cannonball and the rocks and between the rocks and the ship. The cannonball doesn't hit the ship and the rocks don't hit each other.
Here's some idea what the game might look like while being played. The white arrows are just to show movement - they wouldn't appear on the screen.

METHOD: You should use an animation Thread and double-buffering as discussed in class. The input will require setting up an event listener for the keyboard and you'll need to get the focus by having the user click on the window.
Start small. Maybe just have one rock moving across the screen and work on getting the wrap-around correct.
Then, you might add in the ship, but don't worry about the cannon or collisions with the rock. Focus on getting the thrusters to behave correctly. When an arrow key is held down, the ship should move faster and faster in that direction. When the key is released, it should continue to move at the same speed. If the opposite key is pressed, it should slow down the ship and eventually start it moving in the opposite direction. Of course, the ship should wrap around the screen too.
Once all that's working, maybe put in collision testing between the ship and the rock. Next expand to more than one rock, and so on.
Don't have time to do it currently, its not due soon just wondering if anyone wanted to do it lol ill pay $40.
I can give you a template when I start it tomorrow, just so all the basic stuff is there etc.
——
GOAL: Your game should contain a rectangular space ship that can move up, down, left, or right. The movement is controlled by the arrow keys and corresponds to "thrusters" that accelerate when firing, coast when not. This means you need to fire the opposing thruster to stop your ship. When an arrow key is pressed, it should adjust the appropriate component of the velocity and set the other component to zero.
There should be an array of five rocks moving about the screen with (randomly chosen) fixed velocity vectors. When a rock is hit by the cannonball, it should vanish (and be gone from the game). If you destroy all the rocks, you've won. If a rock runs into your ship, you've lost.
When the cannonball is fired, it moves off to the right of the ship at a fixed speed. After a while, the ball disappears.
Objects that move off one edge of the screen should come back in on the opposite edge (wrap-around effect).
You'll need to check for collisions between the cannonball and the rocks and between the rocks and the ship. The cannonball doesn't hit the ship and the rocks don't hit each other.
Here's some idea what the game might look like while being played. The white arrows are just to show movement - they wouldn't appear on the screen.

METHOD: You should use an animation Thread and double-buffering as discussed in class. The input will require setting up an event listener for the keyboard and you'll need to get the focus by having the user click on the window.
Start small. Maybe just have one rock moving across the screen and work on getting the wrap-around correct.
Then, you might add in the ship, but don't worry about the cannon or collisions with the rock. Focus on getting the thrusters to behave correctly. When an arrow key is held down, the ship should move faster and faster in that direction. When the key is released, it should continue to move at the same speed. If the opposite key is pressed, it should slow down the ship and eventually start it moving in the opposite direction. Of course, the ship should wrap around the screen too.
Once all that's working, maybe put in collision testing between the ship and the rock. Next expand to more than one rock, and so on.
Don't have time to do it currently, its not due soon just wondering if anyone wanted to do it lol ill pay $40.
I can give you a template when I start it tomorrow, just so all the basic stuff is there etc.
