Part III Groundwork Error : unexpected private

51 views
Skip to first unread message

Bas Benjamins

unread,
Jan 16, 2016, 10:33:19 AM1/16/16
to HaxeFlixel
Hello, I started to work on the haxeflixel tutorial but somehow it doesn't work for me, while i do everything as they say in the tutorial.

Atm I'am at groundworkIII step 4 and when i test it says: source/MenuState.hx:16: characters 1-8 : Unexpected private

Can someone help me with this? 

this is how the class looks like.

package;

import flixel.FlxG;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.text.FlxText;
import flixel.ui.FlxButton;
import flixel.util.FlxMath;


/**
 * A FlxState which can be used for the game's menu.
 */
class MenuState extends FlxState
 private var _btnPlay:FlxButton;

{
/**
* Function that is called up when to state is created to set it up. 
*/
override public function create():Void
{
_btnPlay = new FlxButton(0, 0, "Play", clickPlay);
add(_btnPlay);
super.create();
}
/**
* Function that is called when this state is destroyed - you might want to 
* consider setting all objects this state uses to null to help garbage collection.
*/
override public function destroy():Void
{
super.destroy();
}

/**
* Function that is called once every frame.
*/
override public function update():Void
{
super.update();
}
private function clickPlay():Void
{
FlxG.switchState(new PlayState());
}
}

Ashiq A.

unread,
Jan 16, 2016, 11:04:00 AM1/16/16
to haxef...@googlegroups.com
Hi,

Your declaration of private variables needs to go in the class, eg.

class MeunState extends FlxState { 
  private var _btnPlay:FlxButton
  ...
}





--
HaxeFlixel Development Community
See our github https://github.com/haxeflixel/ and our documentation http://haxeflixel.com/documentation/
---
You received this message because you are subscribed to the Google Groups "HaxeFlixel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haxeflixel+...@googlegroups.com.
Visit this group at https://groups.google.com/group/haxeflixel.
To view this discussion on the web visit https://groups.google.com/d/msgid/haxeflixel/8957529c-879b-4841-b9a8-64e807a1c951%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bas Benjamins

unread,
Jan 16, 2016, 11:16:39 AM1/16/16
to HaxeFlixel
Omg ofcourse... Thanks!

The haxeflixel setup got me confused so I thought I had it in the class already.... really stupid haha


Op zaterdag 16 januari 2016 17:04:00 UTC+1 schreef Ashiq A.:
Reply all
Reply to author
Forward
0 new messages