Guest User

Untitled

a guest
Jun 16th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package ;
  2.  
  3. import nme.display.Sprite;
  4. import nme.display.Graphics;
  5. import nme.events.Event;
  6. import nme.events.MouseEvent;
  7. import nme.events.KeyboardEvent;
  8. import nme.display.Stage;
  9. import nme.Lib;
  10.  
  11. import nape.geom.Vec2;
  12. import nape.phys.Body;
  13. import nape.shape.Circle;
  14. import nape.shape.Polygon;
  15. import nape.space.Space;
  16. import nape.util.Debug;
  17.  
  18. class Game {
  19.  
  20.    
  21.     public var debug:Debug;
  22.     public var space:Space;
  23.    
  24.     public var STATE_ROTATE:String;
  25.     public var STATE_MOVE:String;
  26.     public var STATE_ACTION:String;
  27.    
  28.     public var playerVecX:Float;
  29.     public var playerVecY:Float;
  30.    
  31.     public var player:Player;
  32.     public var weapons:Weapons;
  33.     public var bullet:Bullet;
  34.  
  35.     public function new(){
  36.     }
  37.    
  38.     public function init():Void
  39.     {
  40.         space = new Space(new Vec2(0,0));
  41.         debug = new ShapeDebug(Lib.current.stage.stageWidth, Lib.current.stage.stageHeight, 0x333333);
  42.         Lib.current.stage.addChild(debug.display);
  43.         Lib.current.stage.addEventListener(Event.ENTER_FRAME, update);
  44.         Lib.current.stage.addEventListener(MouseEvent.CLICK, onClick);
  45.         Lib.current.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
  46.         Lib.current.stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
  47.         trace("first init");
  48.         new PlayerClass();
  49.         new World().createWorld(space);
  50.         player = new Player(Lib.current.stage);
  51.         player.space = space;
  52.         weapons = new Weapons();
  53.        
  54.     }
Add Comment
Please, Sign In to add comment