Tutorial problem.
-
What's up guys? I'm working on a Newgrounds project, however I don't know any language that newgrounds supports. And I heard that Flixel is a good option to start.
I'm taking the dungeon crawler tutorial. And when I have to make the button, and run it, I just get a black screen. What's wrong? Here is my source code. Am I missing something?
package; import flixel.FlxState; import flixel.ui.FlxButton; import flixel.FlxG; import flixel.FlxSprite; import flixel.text.FlxText; import flixel.FlxGame; class MenuState extends FlxState{ private var _btnPlay:FlxButton; private function clickPlay():Void { FlxG.switchState(new PlayState()); } override public function create():Void{ _btnPlay = new FlxButton(0, 0, "Play", clickPlay); add(_btnPlay); _btnPlay.screenCenter(); super.create(); } override public function update(elapsed:Float):Void { super.update(elapsed); } }
-
The initial state has been changed to PlayState. However, you can easily change it in your
Main.hx
.
-
super.create(); has to be the first line on the create function.
-
@agustín-pérez-fernández Actually, it need not to.
As super.create() is just an empty function. I choose to remove it entirely.
-
@dleanjeans Note that that's only true for the default
FlxState
. If you're using flixel-ui /FlxUIState
and not callingsuper.create()
, you're in for a surprise. ;)
-
@gama11 True! Took me a while to find out why things didn't work :P