Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PlayState extends FlxState
- {
- private var promtText:FlxText;
- override public function create():void
- promtText = new FlxText(player.x, player.y +50, 120, "Do you want to enter?\nY for Yes N for No");
- promtText.size = 16;
- promtText.exists = false;
- add(promtText);
- override public function update():void
- {
- FlxU.overlap(player, castle, overlapCastle);
- super.update();
- }
- public function overlapCastle(player:Player, castle:FlxSprite):void
- {
- trace("overlap");
- player.velocity.x = player.velocity.y = 0;
- promtText.exists = true;
- super.update();
- if (FlxG.keys.justPressed("Y"))
- {
- player.x += castle.x -20;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement