Bug when switching animation

OMNILABS

  • Posts: 28
Simple game with egg dropping from top of screen. When the mouse cursor collides with the egg collision box, it plays an animation of the egg breaking and a bird flying out, and 2 seconds later the egg actor is killed.

Randomly (unable to pin down the cause), the animation of the egg breaking jumps back to the first frame while playing back. I though the animation might have been triggering a second time, but I'm using a boolean to only run once, and the debug string is printed just once.

Below is the collision code... A "cursor" actor is just a crosshair following the mouse.

Also attached is a video (not very high quality). Please note that the animation of the egg breaking and bird flying out is 2.5 seconds long (25 x 100ms), so the egg shouldn't reappear as it's killed after 2 seconds. In the video, the first and fourth eggs breaking are ok, with the other 6 exhibiting the problem - the flashing of the animation back to the beginning.

Can anybody suggest anything, or is this a (un)known bug?

Photon

  • Posts: 2693
How do you set the default animation of the egg?
Do NOT PM me your questions, because I likely will not respond. If I have replied to your question on the forum, keep using that topic. Thanks!

OMNILABS

  • Posts: 28
The default animation of the egg is it blinking, with no loop.

That got me thinking... "Randomly" I set the frame to 0 when to make the egg blink. That doesn't check to see if the egg is dying...  :( So... I'm resetting the frame to zero randomly, when the egg is cracking and the animation get's restarted.

Since, I use an attribute "Blinking" to see if I'm already blinking, I just added a line to the above code, right after the "Set Dying to True" stating "for Self, set Blinking to True for behaviour Blink" and that solved it.

Many, many, many, many, many thanks for that.

OMNILABS

  • Posts: 28
Actually, it is still happening for some reason... The "Blink" beheaviour is being triggered even though "Blinking" is set to false. I added a print "Blink" inside the if, and I'm still seeing it be triggered.

When I have more than one egg on screen, and one blinks, the "dying" egg Blink behaviour sometimes get triggered.

Update: I also tried using "for 1st Actor set Blink to True..." and "for Last Collided Actor, set Blink to True..." and Blink would still be triggered if I had more than one egg on screen. Using "Disable behaviour Blink for Self" appears to have solved it.


Here's the revised code and the blink behaviour.

« Last Edit: November 08, 2013, 08:17:16 am by OMNILABS »