Skip to content

Instantly share code, notes, and snippets.

@gltovar
Created November 13, 2017 19:04
Show Gist options
  • Save gltovar/61a8eaef0b4d2e91feb701f0a781db7d to your computer and use it in GitHub Desktop.
Save gltovar/61a8eaef0b4d2e91feb701f0a781db7d to your computer and use it in GitHub Desktop.
package;
import flixel.FlxState;
import flixel.FlxG;
import flixel.input.keyboard.FlxKey;
import flixel.ui.FlxButton;
class PlayState extends FlxState
{
var button:FlxButton;
override public function create():Void
{
super.create();
button = new FlxButton();
add(button);
button.setPosition(100,100);
}
override public function update(elapsed:Float):Void
{
super.update(elapsed);
if(/*FlxG.keys.anyJustPressed([FlxKey.Z]) ||*/ button.justPressed)
{
FlxG.log.add("z just pressed. " + FlxG.game.ticks); // this gets hit twice
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment