managing a t2dAnimatedSprite in a behavior
by rennie moffat · in Torque Game Builder · 04/06/2010 (8:46 pm) · 4 replies
HI I have, in my game a reward. when this reward is hit it must notify the player. It does this with a t2dAnimatedSprite. The sprite appears in position as I ask, but does not play. Why?
I have instructed it to play like this...
but none of this works.
This is a behavior and I was told animations can be difficult in behaviors, but I have gotten plenty others to work. very unsure.
Thanks.
I have instructed it to play like this...
///this... %this.reward2Bonus.setAnimationFrame(0); %this.reward2Bonus.playAnimation(neg10cellsAnimation, false, 0, false); ///this.... %this.reward2Bonus.setAnimationFrame(0); %this.playAnimation(neg10cellsAnimation, false, 0, false); ///and this..... %this.playAnimation(neg10cellsAnimation, false, 0, false); ///and this..... %this.reward2Bonus.playAnimation(neg10cellsAnimation, false, 0, false);
but none of this works.
This is a behavior and I was told animations can be difficult in behaviors, but I have gotten plenty others to work. very unsure.
Thanks.
About the author
My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.
#2
Try the 4 cases again, but this time make sure to look in your console after each. In addition, put an echo statement in your "onCollision" or whatever triggers the animation. I'll bet at least 2 of those tries resulted in error messages.
04/07/2010 (2:54 pm)
I've had sprites animating from behaviors with no problems at all. It shouldn't be difficult.Try the 4 cases again, but this time make sure to look in your console after each. In addition, put an echo statement in your "onCollision" or whatever triggers the animation. I'll bet at least 2 of those tries resulted in error messages.
#3
but what is most puzzling is that, when I trigger the animation to play. I set its position, and put it on a schedule so that it leaves the field of play on completion. It does that. I see, frame 0 pop up when triggered and disappear on schedule.
I will try some echos.
04/07/2010 (3:10 pm)
ok, currently, it is very weird. I have been struggling with this all day, among other things. however what is most puzzling to me. the current way I have works for other behaviors...%this.owner.playAnimation(nameAnimation, false, 0, false);
but what is most puzzling is that, when I trigger the animation to play. I set its position, and put it on a schedule so that it leaves the field of play on completion. It does that. I see, frame 0 pop up when triggered and disappear on schedule.
I will try some echos.
#4
what would you use an an echo?
As in I have used getAnimationFrame() but that seems irrelevant as it only turned up 0's and there is no getIsAnimationPlaying? I am just unsure what my echo needs to call given that I know the function it is in is working. Seems glitchy. I bet it is something extremely stupid though.
04/07/2010 (3:21 pm)
@william, or whoever, what would you use an an echo?
As in I have used getAnimationFrame() but that seems irrelevant as it only turned up 0's and there is no getIsAnimationPlaying? I am just unsure what my echo needs to call given that I know the function it is in is working. Seems glitchy. I bet it is something extremely stupid though.
Torque Owner rennie moffat
Renman3000
thanks.