-
[HELP] How to make a fixed pause with letter P?
Hello guys, how to pause with the letter P with add listener or something, except this example:
Code:
if (Key.isDown(letter))
{
pause = true;
}
-
 Originally Posted by CrazY.
Hello guys, how to pause with the letter P with add listener or something, except this example:
Code:
if (Key.isDown(letter))
{
pause = true;
}
PHP Code:
var listener:Object = new Object();
listener.onKeyDown = function() {
if (Key.getCode() == 80) {
trace("P-Key Pressed.");
pause = true;
}
};
Key.addListener(listener);
-
-
Thank you guys :P, but, case the pause is true, and the player press letter P to unpause the game, this is valid?
PHP Code:
var listener:Object = new Object(); listener.onKeyDown = function() { if (Key.getCode() == 80) { if (!pause) { pause = true; } else { pause = false; } } }; Key.addListener(listener);
-
.
Hi,
Try something along the lines of
PHP Code:
var isPaused:Boolean = false;
function doPause(arg:Boolean):Void { if (arg) { trace("Paused"); } else { trace("unPaused"); } }
var pListener:Object = new Object(); pListener.onKeyDown = function():Void { if (Key.getCode() == 80) { isPaused = !isPaused; doPause(isPaused); } }; Key.addListener(pListener);
-
This seems to suit me, thanks man.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|