Closed Sekhmet closed 9 years ago
This syntax is achieved by using a Haxe feature called static extension. You need to add:
using flixel.util.FlxSpriteUtil;
to the imports section of your module.
Sorry for beating a dead horse - I don't want to open an issue because I'm sure this is user error and my error is similar to the one mentions ... I've started moving my custom Sprite drawings into separate classes and everything has broken. As an example I have the following code.
package tiles;
import flixel.FlxSprite;
import flixel.util.FlxColor;
using flixel.util.FlxSpriteUtil;
class DynamicBlock extends FlxSprite {
public function new(x:Float, y:Float) {
super(x, y);
makeGraphic(32, 32, FlxColor.TRANSPARENT);
drawCircle(32, 32, 4, FlxColor.WHITE);
}
}
When I try to compile it gives me the error Unknown identifier : drawCircle
for the class ... I'm sure I'm doing something stupid but was hoping I might get some help from the pros.
@jfreynik That is actually a recent breaking change in Haxe 4. Static extensions no longer work through implicit this
access. To work around this, simply prefix this
.
@Gama11 - Lifesaver! Thank you 👍
Hi. I'm beginner at Haxe and HaxeFlixel and now I'm trying to create circle on sprite, but I'm receiving following error
flixel.FlxSprite has no field drawCircle
My code is:
I can get it working by calling FlxSpriteUtil.drawCircle but how do I do it with such syntax above?
I see that others are using almost same code and it's working for them.
Haxe version 3.1.3