Game Development Reference
In-Depth Information
The only real difference in this class is the use of a Die class instead of Block class as the single
variable property in the class.
package com.efg.games.dicebattle
{
import flash.events.*;
public class CustomEventClickDie extends Event
{
public var die:Die;
public static const EVENT_CLICK_DIE:String = "eventClickDie";
public function CustomEventClickDie(type:String, die:Die,
bubbles:Boolean=false,cancelable:Boolean=false)
{
super(type, bubbles,cancelable);
this.die = die;
}
public override function clone():Event {
return new CustomEventClickDie(type, die, bubbles,cancelable)
}
public override function toString():String {
return formatToString(type, "type", "bubbles", "cancelable", "eventPhase");
}
}
}
Creating the Character class
The Character class is very simple class that we will use to represent the tile from the characters
tile sheet in the library. In a way, it is simply a subclass of BlitSprite . We created this class so
that it could be potentially expanded upon in a further iteration of this game. You should keep this
thought in mind as you progress through this chapter, “What are some ways I could improve this
game with my own ideas and code?”
package com.efg.games.dicebattle
{
import flash.display.Shape;
import flash.display.Sprite;
import flash.display.Bitmap;
import flash.display.BitmapData;
import com.efg.framework.BlitSprite;
import com.efg.framework.TileSheet;
public class Character extends BlitSprite {
public function Character(ts:TileSheet, tile:Number) {
Search WWH ::




Custom Search