Return to Snippet

Revision: 52052
at October 12, 2011 09:49 by NoTalentGeek


Initial Code
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);
		}
	}
}

Initial URL

                                

Initial Description

                                

Initial Title
50. FlashDevelop ActionScript3.0 Flixel2.5 FlixelPowerTool Test Again - PlayState

Initial Tags

                                

Initial Language
ActionScript 3