FlxSprite.makeGraphic and FlxSpriteUtil draw tools ~weird stuff~

68 views
Skip to first unread message

literalcitrus

unread,
Jan 6, 2016, 6:41:15 AM1/6/16
to HaxeFlixel
I'm using two separate FlxSprites of the same size (400x400) to draw lines in my game. One is used to draw an indicator of sorts and the other draws lines. I have them split so I can manually erase one while keeping the contents of the other. What I found was that whenever I used FlxUtil.fill() on one of the FlxSprites, it applied the fill color to both sprites (I was using FlxColor.TRANSPARENT so the lines simply disappeared). I don't know if this is intentional as it isn't stated anywhere in documentation, but when I changed the dimensions of one of the FlxSprites to 400x401 each sprite then responded properly to fill() calls given to it.

Is this due to some way that HaxeFlixel handles graphics generated at run time? Seems that sprites of the same dimension (and possibly color as both are filled with transparency after being created) are one in the same and are simply being pointed to by whatever FlxSprite generates it.

Gama11

unread,
Jan 6, 2016, 7:15:16 AM1/6/16
to HaxeFlixel
Same dimensions and same color means the graphics use the same key in Flixel's cache. You can set the Unique parameter of makeGraphic() to true to avoid this.

literalcitrus

unread,
Jan 6, 2016, 7:57:44 AM1/6/16
to HaxeFlixel
Clearly I didn't real enough of the docs, thanks for the heads up.
Reply all
Reply to author
Forward
0 new messages