Play my new game from here and enjoy yourselves.
Stars War
Game Detail:
The game contains 6 main classes including:
- startStarswar(Main Class)
- BulletEngine
- Tank
- Jet
- Helicopter
- Plane
startStarswar:
This is the main class. It handles Objects initiation, make game ground, handles key events, arrange enemies and finally checks if game or level ends then decide what to do. On the other hands this class manages their objects and their attitudes.
BulletEngine:
This class handles the bullets both player's bullets and enemy's bullets. I moves the bullets forward (for player's bullets) and backward (for enemy's bullets) and check if two bullets crashes, omit them. If a bullet crashes to player, it should explode it so runs explode method of player object. Also if a bullet crashes to enemy, it should explode it so runs explode method of enemy object.
Tank:
Tank is player. It can just move up and down. It can shoot on space key down or enter key down events. It has 4 lives. So in explode method it decrease the live flag and check if it gets less than 0, It raise Game Over.
Jet:
It is the first level enemy. It moves up and down. The up and down strategies are fully random. It also shoots and it is also random. It has 20 lives. So in explode method it decrease the live flag and check if it gets less than 0, it raise showNextEnemy method of startStarsWar object. This method will show next enemy(Helicopter).
Helicopter:
It is the second level enemy. This class resembles Jet class. It also can move right and left. The movements are fully random. It also have 40 lives and it can shoot 1 or 3 bullets any time. Its shooting strategy is random. It can moves left to 1/2 of the screen.
Plane:
It is the 3rd level enemy. This class resembles Jet class. It also can move right and left. The movements are fully random. It also have 60 lives and it can shoot 1 or 2 or 5 bullets any time. Its shooting strategy is random. It can moves left to 2/3 of the screen.
Again I emphasize take a look starswar.js file. It contains a good point of objective javascript.
No comments:
Post a Comment