Question: In this programming project, you are to use Code 12 to write a game with specific given requirements. There is also room for creativity

In this programming project, you are to use Code 12 to write a game with specific given requirements. There There are only five objects involved in the game play: 1. The alien. There is only one. He zig-zags downward You can think of the game as a number of behaviors that you need to get working. The required behaviors for 3. If there is not already a bullet in the air, pressing the space bar fires one. The bullet starts at the 8. If the bomb hits the gun, the game is over. Hint: Check if a bomb exists then use obj.hit() 9. If the bomb

In this programming project, you are to use Code 12 to write a game with specific given requirements. There is also room for creativity and adding extras, but most of your grade will be based on getting the required features working. As a simplified version of the famous and really old Space Invaders video game (also search on YouTube), you will write Space Invader! (singular). In this version of the game, there is only one alien invader (but he's pissed and persistent), and also only one barrier, and other simplifications, as follows: There are only five objects involved in the game play: 1. The alien. There is only one. He zig-zags downward towards you and speeds up as he gets lower. 2. The gun. You move this left and right with the arrow keys, at the bottom of the screen. 3. The barrier. There is one, horizontally centered, and a little above the gun. 4. The bullet. Pressing the space bar fires a bullet straight up from the gun. There can be only one bullet on the screen at a time, so pressing space does nothing if there is already a bullet in flight. 5. The bomb. The alien drops a bomb straight down at the gun when it is over the gun. There can be only one bomb on the screen at a time, so the alien drops one only when passing over the gun and if there is not already a bomb in the air. You can think of the game as a number of behaviors that you need to get working. The required behaviors for full credit are: 1. The alien starts near the upper-left of the screen and starts moving horizontally to the right at a medium-slow speed. When the alien gets to the right edge of the screen, he moves down a step and starts moving back horizontally to the left. When he gets to the left edge, he moves down another step and starts moving horizontally to the right again. Each time the alien makes a step downward, his speed increases by 20% or so. Hint: Use obj.setXSpeed(), obj.getXSpeed(), and obj.y 2. The gun moves smoothly to the left and right when the left and right arrow keys are held down. Hint: Use ct.keyPressed() 3. If there is not already a bullet in the air, pressing the space bar fires one. The bullet starts at the gun position and moves straight up. Hint: Test if the bullet exists first (see Deleting Objects below), then use ct.keyPressed() 4. If the bullet hits the alien, the score increases by one, the alien restarts at the top-left, and the bullet is deleted. Hint: Test if the bullet exists first, then use obj.hit() 5. If the bullet goes off the screen on the top, it is deleted. Hint: See Deleting Objects below and remember that you can't test the position of a deleted object. 6. If the bullet hits the barrier, the bullet is deleted. Hint: Test if the bullet exists first, then use obj.hit() 7. If there is not already a bomb on the screen and the alien is passing over the gun, then the alien drops a bomb. The bomb starts at the alien position and moves straight down at the gun. Hint: Does a bomb already exist? Where is the alien compared to the gun? Note that the alien moves quickly so you can't compare equivalence of the x 8. If the bomb hits the gun, the game is over. Hint: Check if a bomb exists then use obj.hit() 9. If the bomb goes off the screen to the bottom, it is deleted. Hint: Check if a bomb exists, check bomb.y, then see Deleting Objects below. 10. If the bomb hits the barrier, the bomb is deleted. Hint: Check if a bomb exists, use obj.hit(), then see Deleting Objects below. 11. If the alien hits the gun (and thus made it all the way to the bottom), the game is over. Hint: Use obj.hit() 12. When the game is over, the user is asked if they want to play again. If they answer Yes, the game restarts, otherwise it stops. Hint: Use ct.input YesNo(), ct.restart(), and ct.stop()

Step by Step Solution

3.54 Rating (151 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Space Invader which is a simplified version of the Space Invaders video game The game involves five objects the alien the gun the barrier the bullet a... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!