loadGraphicFromTexture not supported for Sprite Group?!

27 views
Skip to first unread message

Shaun Michael K. Stone

unread,
Jul 5, 2015, 8:51:56 AM7/5/15
to haxef...@googlegroups.com
So I am trying to create a GameObject class that extends from FlxTypedSpriteGroup because I want one sprite for the animation, and another for the shadow of the sprite. I want to use the shadow as the collision object instead of the main player sprite as it causes complications with collision. I was shocked to find that this isn't supported:

/**
* This functionality isn't supported in SpriteGroup
* @return this sprite group
*/
override public function loadGraphicFromTexture(Data:Dynamic, Unique:Bool = false, ?FrameName:String):FlxSprite 
{
#if !FLX_NO_DEBUG
FlxG.log.error("loadGraphicFromTexture() is not supported in FlxSpriteGroups.");
#end
return this;
}

So the question is, when or will this ever be possible? Because it has now blocked my game development. It seems bizarre that something like this isn't supported.

Thanks.

SruloArt

unread,
Jul 5, 2015, 9:46:49 AM7/5/15
to haxef...@googlegroups.com
It's just a container, you can't "loadGraphic" into a bunch of FlxSprites :)

You need to create these FlxSprites (player, shadow), add them to the SpriteGroup and then handle collisions only with the shadow FlxSprite instead of the all SpriteGroup.
Reply all
Reply to author
Forward
0 new messages