Advertisement
Guest User

Untitled

a guest
May 28th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public class PlayState extends FlxState
  2.     {
  3.  
  4.         private var promtText:FlxText;
  5.  
  6.         override public function create():void
  7.  
  8.  
  9.             promtText = new FlxText(player.x, player.y +50, 120, "Do you want to enter?\nY for Yes N for No");
  10.             promtText.size = 16;
  11.             promtText.exists = false;
  12.             add(promtText);
  13.  
  14.  
  15.         override public function update():void
  16.         {          
  17.             FlxU.overlap(player, castle, overlapCastle);
  18.             super.update();
  19.                        
  20.         }
  21.  
  22.         public function overlapCastle(player:Player, castle:FlxSprite):void
  23.         {
  24.             trace("overlap");
  25.             player.velocity.x = player.velocity.y = 0;
  26.             promtText.exists = true;
  27.             super.update();
  28.            
  29.             if (FlxG.keys.justPressed("Y"))
  30.             {
  31.                 player.x += castle.x -20;
  32.             }
  33.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement