Guest User

Untitled

a guest
Jan 24th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. package
  2. {
  3. import flash.display.Sprite;
  4. import flash.events.Event;
  5. import flash.events.KeyboardEvent;
  6. import flash.display.Stage;
  7.  
  8. /**
  9. * ...
  10. * @author MindGem
  11. */
  12. public class HeroClass extends Sprite
  13. {
  14. public var hero:Hero = new Hero();
  15. private var maxSpeed:Number = 5;
  16.  
  17. public function HeroClass()
  18. {
  19. addChild(hero);
  20. hero.x = 250;
  21. hero.y = 250;
  22. hero.gotoAndStop(1);
  23.  
  24. addEventListener(KeyboardEvent.KEY_DOWN, heroMovement);
  25. }
  26.  
  27. public function heroMovement(e:KeyboardEvent):void
  28. {
  29. switch(e.keyCode)
  30. {
  31. case Keyboard.KEY_DOWN:
  32. trace("test");
  33. break;
  34. }
  35. }
Add Comment
Please, Sign In to add comment