Top  Previous  Next

This month's plug and play snippet is named "Plane" because I couldn't find a better name. In fact, now that I think about it, I could have named it "Plane and Tank", because we'll also get to fight against a tank. Actually, there are several tanks, so an even better name would have been "Plane and Tanks". Or "Plane and Tanks and Health packs", because we'll encounter several of these in the level as well. It's all too complicated, so now you see why I simply chose to name the snippet "Plane".


As you already know, our hero drives a plane, trying to destroy as many enemy tanks as possible. I have create a huge playground (about 65,000 x 50,000 quants), but it can get filled quite fast because a new tank is created every 30 seconds. It is true that we are also creating a health pack every 30 seconds, but this isn't necessarily comforting news.


Take a look at the digits in the upper left corner of the screen; they show player's pan, tilt and roll angles, the altitude and the speed of the plane, the number of quants that were covered during the last engine frame and player's armor value.




Use the "W", "S", "A" and "D" keys to control the player and "Q" and "E" to increase or decrease its speed. Press and hold the left mouse; you'll be able to fire about 10 bullets per second. Since you've got an unlimited amount of bullets (and you thought that I am a bad guy!) you can take the enemies out while they are far, far away, just like I did in the picture below.




But you aren't like me: you are a true warrior, so you will want to come closer to the tanks and fight them like a real man.




If you aren't a manly man, you will be glad to know that I have made these rockets miss their target from time to time by adding a random angle of  up to -10... +10 degrees to the correct target angle.




The player dies when either its armor reaches zero or when it collides with the ground or with a tank. In fact, I have also implemented proper landing code for the plane, so if your tilt angle and your speed are right when you are trying to land, the player will be fine.




Fortunately, I have included health packs in the level as well, so you'll be able to restore player's armor if you land nicely or fly very close to the ground and run into the health packs.




The code is very well commented.