Air Force
airforce_starter_.zip |
This game will be all about trying to live as long as you can!
To be done AFTER Lunar Lander OR done with this video here!:
The Main Character...
The Obstacles...
The Defence...
Additional Challenges:
To be done AFTER Lunar Lander OR done with this video here!:
The Main Character...
- Make it so that the amount of iterations that have happened show up on the screen.
- Add the Airplane to the centre of the screen. Gravity should be pulling it down constantly at a rate of 0.2 pixels per iteration. When the up key is pressed, adjust the velocity of the Airplane upwards at a rate of 0.5 pixels per iteration. (Watch the class tutorial here if you missed this!) If the Airplane is touching a building, the ground, or the top of the world, the game is over.
- The Airplane should get 3 lives. These should be displayed somewhere on the screen.
The Obstacles...
- Add an Enemy airplane to the right edge of the screen .5% of the time, randomly on the y-axis (but not so low that they hit the buildings). Make it move from right to left and remove it at the left hand side of the screen. If Airplane hits an Enemy, the Airplane should lose a life, and the enemy should be removed. The lives should be displayed somewhere on the screen.
- Add a building to the right hand side of the world 1% of the time and add this to the screen at the proper Y value so that it's not looking like it's floating. It should show up randomly as one of the 3 buildings. (Hint: constructors would be helpful here so that you can add in the buildings at a proper height, then select the proper image based on the height you have added it at.) The building should remove itself at the left edge of the world. Make the game end if the Airplane hits a building.
Note: If you cannot figure out the constructor piece, just add ONE of the 3 buildings.
The Defence...
- Create a Bullet class, finding an image that works for you online. You can resize it using https://imageresizer.com/. Make the bullet move from left to right and remove itself at the edge of the world.
- The Airplane should get 10 bullets to start. It should shoot Bullet objects when the space key is pressed ONLY if it has bullets left. If the bullet hits the enemy, the enemy and the bullet should disappear. These Bullet amount should be displayed somewhere on the screen.
- Add an Ammo Pack to the world every 200 iterations. This Ammo Pack provides more bullets for the Airplane. Make it move from right to left and remove it at the left hand side of the screen. If the airplane touches the Ammo, they get 10 more bullets and the Ammo should disappear.
Additional Challenges:
- Make it so that none of the buildings show up on top of one another
- Include a scrolling background. This can be done with 2 background objects. (Note: in the MyWorld constructor, change the first line to super(1000, 375, 1, false); )
- Create 1ups (extra lives) that the airplane can obtain.
- Make the enemies shoot bullets as well .5% of the time.
- Watch the tutorial on adding smoke in order to add smoke to our airplane.
- Make it so that your Main Character gets points for hitting enemy planes. These should be displayed in the world.