Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ActionScript 3 Example 8 AreaGroup Version 1
package
{
/**
* ...
* @author Dan Cox
*/
import org.flixel.*;
public class AreaGroup extends FlxGroup
{
private var areaMap:FlxTilemap;
private var _swapFunction:Function;
public var characters:NPCSpriteGroup;
public var doorTile:Number;
public var doorPoint:FlxPoint;
/**
* AreaGroup
* @param map The tilemap data
* @param tiles The tiles
* @param dT The door or exit tile number
*/
public function AreaGroup(map:Class, tiles:Class, dT:Number)
{
doorTile = dT;
areaMap = new FlxTilemap();
areaMap.loadMap(new map, tiles, 16, 16, 0, 0, 1, 2);
add(areaMap);
characters = new NPCSpriteGroup();
add(characters);
var points:Array = areaMap.getTileCoords(doorTile, false);
doorPoint = points[0];
}
public function set swapFunction(func:Function):void
{
_swapFunction = func;
areaMap.setTileProperties(doorTile, FlxObject.ANY, func);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.