Game Development Reference
In-Depth Information
return(tileList);
}
}
}
The
createRotationBlitArray
and
createFadeOutBlitArray
methods you have just seen will be
used to create the objects in our games that will store their look and feel in arrays of
BitmapData
objects.
Next, we will take a look at the base class for all of our game objects. The base class will be
called
BasicBlitArrayObject
. The
BlitArrayAsset
class will used create the look of these
BasicBlitArrayObjects
inside the "
Manager"
classes that we will discuss later in this section.
Designing the BasicBlitArrayObject class
Instead of a tile sheet for the game in this chapter, we will be drawing our graphics in code and
using an
Array
of
BitmapData
instances to simulate animation.
BasicBlitArrayObject
is a base
class for objects that are animated as an array of
BitmapData
objects. It contains four public
functions and an assortment of public properties that are necessary to move the object on the
screen and animate its appearance with an array of
BitmapData
objects. This class will be added
to the framework package.
The package location is
com.efg.famework
.
These are the public attributes:
public var x:Number
: The
x
location (top-left corner) of the object for blitting to the
canvasBitmapData
public var y:Number
: The
y
location (top-left corner) of the object for blitting to the
canvasBitmapData
public var nextX:Number
: Updated in the update cycle of the game and applied to
x
in
the render
public var nextY:Number
: Updated in the update cycle of the game and applied to
y
in
the render
public var dx:Number
: The change in
x
to apply to
nextX
in the update cycle
public var dy:Number
: The change in
y
to apply to
nextY
in the update cycle
public var frame:int
: The current index of the
animationList
array
public var bitmapData
: A local reference to the
BitmapData
represented by
animationList[frame]
public var animationList:Array
: The local
Array
of
BitmapData
references to loop
through for animation
public var point:Point
: The global
Point
reference for the
copyPixels
operation
public var speed:Number
: The value to add to
dx
and
dy
on each update
public var xMax:int
: The maximum
x
blit location for the object
public var yMax:int
: The maximum
y
blit location for the object
public var xMin:int
: The minimum
x
blit location for the object
public var yMin:int
: The minimum
y
blit location for the object