1. Game Engine
The first thing to do in aircraft war is to consider which parts of the game are divided into? So we do it together, especially clear. So then we'll simply analyze which parts of the aircraft war are divided.
1. Game Engine
2. Hero Machine
3. Enemy aircraft
4. Bullets
5, the enemy aircraft also divided into small medium -sized large but this we can directly inherit some of the methods of enemy aircraft just fine
So next we'll analyze the main properties and methods of each chunk.
Game engine
Property:
Game State ===== "GameStatus
All enemy aircraft ===== "enemy
All Bullets ===== "bullet
Game Score ===== "Scroe
Function:
Game start
Background move
Create an enemy plane, create a hero machine
Enemy aircraft and bullet movement
Collision detection
Game Over
Hero machine
Picture = =" Self
Position = = = "Top left
function:
Initialize = =" Init
Mobile = = "Move
bullets = =" Shoot
destroy = = Destroy
explode = = Bang
enemy aircraft
Picture = =" Self
location = = Top Left
speed = = = "Tempo
pictures before and after the explosion IMGs
Span style= "font-size:14px" > method:
Initialize = = "Init
move = =" Out of bounds destroy
destroy = =" Destroy
explode = = = Bang
Bullet
Property:
Picture ====>self
Location = = "Top Left"
Speed = =
Method:
Initialize = = = "Init"
Mobile = = "Out of Bounds"-collision
Destroy = = = "Destroy
JavaScript Aircraft Wars-----001 Analysis