Game Development Reference
In-Depth Information
It is prepopulated with values that work well for our purposes, but
these are all easily changed later.
package com.flashgamebook.engines.platformer {
import flash.geom.Rectangle;
import flash.geom.Vector3D;
import flash.ui.Keyboard;
public class PlatformerConfig {
public var gravity:Vector3D = new Vector3D(0,25);
public var friction:Number = .75;
public var drag:Number = .92;
//INPUT
public var keyJump:int = Keyboard.UP;
public var keyUse:int = Keyboard.DOWN;
public var keyLeft:int = Keyboard.LEFT;
public var keyRight:int = Keyboard.RIGHT;
//PLAYER PROPERTIES
public var playerMovement:Vector3D = new Vector3D(30);
public var playerJump:Vector3D = new Vector3D(0,-10);
}
}
Notice this is a good way of creating and assigning input schemes,
as well as defining things like the effects of gravity and friction.
The GridReference Class
As stated earlier, every square on the game grid has an associated
GridReference object. It stores whichwalls,enemies,items,and
portals are in a given square.
package com.flashgamebook.engines.platformer {
import com.flashgamebook.engines.platformer.sprites.*;
public class GridReference {
public var walls:Vector. < IWall > = new Vector.
< IWall > ();
public var items:Vector. < IItem > = new Vector.
< IItem > ();
public var enemies:Vector. < IEnemy > = new Vector.
< IEnemy > ();
Search Nedrilad ::




Custom Search