Game Development Reference
In-Depth Information
The Game Class
For this example, all of the classes associated with game code are in
the
package, differentiating itself from the main engine.
One of these classes is tied to the PlatformerExample.fla file, found
with the Chapter 14 support files. The other classes are related to
the assets, which we will examine shortly.
example
The PlatformerExample Class
The document class used for this example handles creation of the
engine instances, as well as notification and progress messaging.
package example {
import flash.display.Sprite;
import flash.events.ProgressEvent;
import flash.text.TextField;
import com.flashgamebook.engines.platformer.*;
import com.flashgamebook.engines.platformer.events.
PlatformerEvent;
public class PlatformerExample extends Sprite{
public var pointsText:TextField;
public var loadingText:TextField;
public var percentText:TextField;
public var gameOverText:TextField;
private var _platformer:PlatformerEngine;
private var _config:PlatformerConfig;
private var _level:int = 0;
private var _score:Number = 0;
private var _previousScore:Number = 0;
public function PlatformerExample() {
nextLevel();
}
public function nextLevel() {
_level++;
loadingText.visible = true;
percentText.text = " 0% " ;
percentText.visible = true;
gameOverText.visible = false;
_platformer = new PlatformerEngine();
_config = new PlatformerConfig();
Search Nedrilad ::




Custom Search