I've been starting to fiddle around with HaxeFlixel recently and when trying to make a real simple game, I come across this error:
source/PlayState.hx:10: characters 7-16 : Class not found : GameLogic
Now this isn't my first foray into programming games or anything, but I have no clue why this error is popping up. For starters, GameLogic isn't even a class, it's a package. The error comes up when I try to import my basic Player class from my GameLogic package.
My Basic Player Class:
package GameLogic;
import flixel.FlxSprite;
import flixel.util.FlxColor;
class Player extends FlxSprite {
public function new(X:Float=0, Y:Float=0) {
super(X, Y);
makeGraphic(32, 32, FlxColor.WHITE);
}
}
Where the exception is thrown:
import GameLogic.Player;
class PlayState extends FlxState{
private var p:Player;
override public function create():Void{
p = new Player(20, 20);
add(p);
super.create();
}
My [relevant] directory Structure:
| src
| | GameLogic
| | | Player.hx
| | PlayState.hx
As the Haxe docs states:
you have to name your package
gameLogic
with a lowercaseG
to be recognized as proper package name. The relevant parts in the up-to-date docs read slightly more complicated, but in essence mean the same with regard to this question:The algorithm for name resolution is outlined here in more detail.