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


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. package {
  2. import org.flixel.*;
  3.  
  4. public class PlayState extends FlxState {
  5. private const TILE_WIDTH:uint = 16;
  6. private const TILE_HEIGHT:uint = 16;
  7.  
  8. [Embed(source = '../assets/map/map.txt', mimeType = "application/octet-stream")]
  9. private var txtMap:Class;
  10.  
  11. [Embed(source='../assets/map/map.png')]
  12. private var pngMap:Class;
  13.  
  14. private var map:FlxTilemap;
  15.  
  16. private var hero:Hero;
  17.  
  18. public function PlayState():void {
  19. super();
  20. }
  21.  
  22. public override function create():void {
  23. super.create();
  24.  
  25. map = new FlxTilemap();
  26. map.loadMap(new txtMap(), pngMap, TILE_WIDTH, TILE_HEIGHT, FlxTilemap.OFF);
  27.  
  28. hero = new Hero(20, 20);
  29.  
  30. add(map);
  31. add(hero);
  32. }
  33.  
  34. public override function update():void {
  35. super.update();
  36.  
  37. FlxG.collide(map, hero);
  38. }
  39. }
  40. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.