/ Published in: ActionScript 3

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
package { import org.flixel.*; public class PlayState extends FlxState { private const TILE_WIDTH:uint = 16; private const TILE_HEIGHT:uint = 16; [Embed(source = '../assets/map/map.txt', mimeType = "application/octet-stream")] private var txtMap:Class; [Embed(source='../assets/map/map.png')] private var pngMap:Class; private var map:FlxTilemap; private var hero:Hero; public function PlayState():void { super(); } public override function create():void { super.create(); map = new FlxTilemap(); map.loadMap(new txtMap(), pngMap, TILE_WIDTH, TILE_HEIGHT, FlxTilemap.OFF); hero = new Hero(20, 20); add(map); add(hero); } public override function update():void { super.update(); FlxG.collide(map, hero); } } }
Comments
