package core; import flixel.FlxG; import flixel.FlxState; import flixel.addons.display.FlxStarField.FlxStarField2D; import flixel.text.FlxText; import flixel.util.FlxColor; import levels.Level1; import utils.Constants; import utils.Debug; class MenuState extends FlxState { override public function create() { Debug.log("Menu State"); var title1 = generateText("Your Enemy is in Another", 24, Constants.defaultFont); var title2 = generateText("Dungeon", 30, Constants.stylyzedFont); title2.y = title2.y + 25; title2.color = FlxColor.RED; title2.angle = -9.74; var starfield:FlxStarField2D = new FlxStarField2D(0, 0, FlxG.width, FlxG.height, 500); add(starfield); add(title1); add(title2); if (FlxG.sound.music == null) { FlxG.sound.playMusic(AssetPaths.TitleMusic__ogg, 1, true); } super.create(); } override public function update(dt:Float) { if (FlxG.keys.anyPressed([X])) { FlxG.sound.music.stop(); FlxG.switchState(new Level1()); } super.update(dt); } private function generateText(text:String, size:Int, font:String) { var displayText:FlxText = new FlxText(); displayText.text = text; displayText.size = size; displayText.font = font; displayText.screenCenter(); return displayText; } }