Game Development Reference
In-Depth Information
Figure 10-9. Iteration 3 in action—well, not much action yet
Adding player input and the update / render loop (iteration 4)
In this iteration, you will finally start to see things come alive in our game. By the time we are
finished, you will be able to drive around the world and scroll it in all directions but without any
collision detection.
The update function
The update function contains a lot of very important logic for simulating movement for the car and
the world:
private function update():void {
player.move = true;
//*** update turnSpeed based on velocity
if (player.velocity == 0) {
player.turnSpeed = 0;
}else {
player.turnSpeed = player.minTurnSpeed + (Math.abs(player.velocity/10));
Search WWH ::




Custom Search