Using .image and then setSpriteAnimation() gives error message.
-
Doing the following:
a = createSprite() a.image = myImage setSpriteAnimation(a, b, c)
yields the following error message:
Sprite image must be set before calling setSpriteAnimation.
The workaround is to use
setSpriteImage(a, myImage)
instead, but I prefer to set the Sprite params directly.
-
At first I dont know anything about sprites but i think you can only use a.image when you declared it at first in a struct but maybe i could be totally wrong
-
@vinicity I think that this is a known problem with this sprite property
-
@pianofire Is it a bug ?
-
It is not a bug.
Accessing the image of a sprite directly like that is not implemented. It is one of the few that is not. I confirmed this for myself last week when I was trying to do this myself and it was not working (I have access to the source code). By writing
a.image = myImage
you have created a custom sprite property that has nothing to do with the sprite's image. You must usesetSpriteImage(sprite, image)
in this instance.[edit] I suppose it is fair to say that it is a bug in the help pages :)
-
@Martin I had better update it then!
-
Not had my daily pint of tea yet :)
-
OK, so the bug is with the Help page, and setting it directly is not supported. That's fine. I was fooled by the Help page... :)
It would be great if all the sprite params would be accessible directly, though. It feels kind of arbitrary at this time which are and which are not.