Game Development Reference
In-Depth Information
new Ex22Gif(0,0),
new Ex23Gif(0,0),
new Ex24Gif(0,0),
new Ex25Gif(0,0)
];
setNextImage();
frameCounter=0;
finished=false;
}
public function setNextImage():void{
currentImageIndex++;
if (currentImageIndex > images.length-1) {
finished=true;
} else {
image.bitmapData = images[currentImageIndex];
}
}
public function update():void {
frameCounter++;
}
public function render():void {
if (frameCounter >= frameDelay && !finished) {
setNextImage();
frameCounter=0;
}
}
public function dispose():void {
removeChild(image);
for each ( var tempImage:BitmapData in images ) {
tempImage.dispose();
}
images = null;
}
}
}
Summary
In this chapter, you learned some basic concepts for designing a game, managing game difficulty,
creating and adding sounds and graphics, and supporting the differences between Flash and Flex
libraries, plus how to move sprites using two different vector algorithms and how to animate
sprites in code. In the next chapter, we will put all of this together to make our fourth game, Flak
Cannon, the second project that utilizes our game framework.
Search WWH ::




Custom Search