Created
October 30, 2013 02:41
-
-
Save videlais/7226435 to your computer and use it in GitHub Desktop.
ActionScript 3 Example 8 AreaGroup Version 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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