Game Development Reference
In-Depth Information
These are the public functions:
public function BasicBlitArrayObject(xMin:int,xMax:int, yMin:int, yMax:int ) :
The constructor takes in values to set the maximum and minimum blit location (both x
and y) for the object. It is up to the children of this base class to decide what to do with
the attributes during the update cycle.
public function updateFrame(inc:int):void : The updateFrame function takes in the
inc (increment) and sets the frame property of the object. The bitmapData is then
assigned a reference to the animationList[frame] item.
public function render(canvasBitmapData:BitmapData):void : The render function
takes a single BitmapData instance, canvasBitmapData . The object's bitmapData is
copied to the canvasBitmapData with a copyPixels operation
Here is the full source code to the BlitArrayObject class:
package com.efg.framework
{
import flash.display.BitmapData;
import flash.geom.Point;
import flash.events.EventDispatcher;
import flash.geom.Rectangle;
public class BasicBlitArrayObject extends EventDispatcher{
public var x:Number = 0;
public var y:Number = 0;
public var nextX:Number = 0;
public var nextY:Number = 0;
public var dx:Number = 0;
public var dy:Number = 0;
public var frame:int = 0;
public var bitmapData:BitmapData;
public var animationList:Array=[];
public var point:Point = new Point(0, 0);
public var speed:Number=0;
public var xMax:int=0;
public var yMax:int=0;
public var xMin:int=0;
public var yMin:int=0;
public function BasicBlitArrayObject(xMin:int,xMax:int, yMin:int, yMax:int ) {
this.xMin = xMin;
this.xMax = xMax;
this.yMin = yMin;
this.yMax = yMax;
}
public function updateFrame(inc:int):void {
frame += inc;
if (frame > animationList.length-1) {
frame = 0;
Search WWH ::




Custom Search