Skip to content

Instantly share code, notes, and snippets.

@schonstal
Last active December 20, 2015 20:19
Show Gist options
  • Select an option

  • Save schonstal/6189985 to your computer and use it in GitHub Desktop.

Select an option

Save schonstal/6189985 to your computer and use it in GitHub Desktop.
how to pause
var pauseGroup:PauseGroup;
var paused:Boolean = false;
public override function create():void {
//your normal create
pauseGroup = new PauseGroup();
}
public override function update():void {
if(FlxG.keys.justPressed(MY_PAUSE_BUTTON)) {
paused = !paused;
}
if(!paused) {
updateLogic();
super.update();
} else {
pauseGroup.update();
}
}
public override function draw():void {
super.draw();
if(paused) pauseGroup.draw();
}
private function updateLogic():void {
//Your update goes here
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment