Last active
August 31, 2016 10:49
-
-
Save DleanJeans/5f71159386f8b0ddfc862bea92b48407 to your computer and use it in GitHub Desktop.
Interstate Text Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package; | |
import flixel.FlxG; | |
import flixel.FlxState; | |
import flixel.addons.text.FlxTextField; | |
import flixel.system.FlxAssets; | |
import flixel.text.FlxText; | |
class PlayState extends FlxState { | |
public var text:FlxText; | |
override public function create():Void { | |
text = MenuState.text; | |
add(text); | |
} | |
override public function update(elapsed:Float):Void { | |
super.update(elapsed); | |
if (FlxG.keys.justPressed.SPACE) { | |
remove(text); | |
FlxG.switchState(new MenuState()); | |
} | |
if (FlxG.keys.justPressed.ONE) { | |
text.alignment = text.alignment == FlxTextAlign.CENTER ? FlxTextAlign.LEFT : FlxTextAlign.CENTER; | |
} | |
else if (FlxG.keys.justPressed.TWO) { | |
text.fieldWidth = text.fieldWidth == FlxG.width ? 0 : FlxG.width; | |
text.screenCenter(); | |
} | |
else if (FlxG.keys.justPressed.THREE) { | |
text.font = text.font == FlxAssets.FONT_DEFAULT ? FlxAssets.FONT_DEBUGGER : FlxAssets.FONT_DEFAULT; | |
} | |
else if (FlxG.keys.justPressed.ENTER) { | |
text.drawFrame(true); | |
// does not work | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment