Game Development Reference
In-Depth Information
tempEnemy.currentDirection = MOVE_STOP;
tempEnemy.animationLoop = false;
addChild(tempEnemy);
enemyList.push(tempEnemy);
break;
//** end added in iteration #5
Testing iteration 5
When you test this iteration, you should see all of the enemy tanks placed on the screen, as
shown in Figure 7-5.
Figure 7-5. Iteration 5's game screen with tanks
Allowing enemy tank movement with the AI
(iteration 6)
Now we are getting somewhere! The enemy tanks are on the screen, and we must get them to
chase the player. One thing we have left out of the code so far is the player tank setting its own
region. Once we have done that, we can add AI and movement code to the enemy tanks so they
will start to chase the player tank if it is in the same region as an enemy tank (or tanks).
Search WWH ::




Custom Search