Need help with animation stopping
Hi All
I Have built a game similar to the Whack a Monster template. (Whack A Mole Type Game)
I have animation up working and down working but i want an animation in between basically an idle animation.
Actor Pop Up Code
If Self.Enemy.Up is false - Do Timer Random 1,10 Animate & Change Attribute Self.Enemy.Up to True
Actor Pop Back Down Code.
If Self.Enemy.Up is True Do - Timer Random 1,4 Animate & Change Attribute Self.Enemy.Up to False
Now problem is i want to add another animation in between actor up and actor down kind of a waiting motion/idle
the code i have is:
Rule When self image contains (Last image of the up animation) Do Animate.
Now it will work but the image will change but it will not animate it changes to a still image.
What am i doing wrong.
Thanks in advance.
Comments
Your rule looks something like this:
When self.Image=animation45.png
Animate
The problem is that when the animation begins, self.Image changes value to whatever the first frame is (e.g. animation1.png). So the rule condition becomes false and the animation stops.
You can fix this one of two ways... either by changing an attribute value or by using a Timer with run to completion checked:
Method 1:
When self.Image=animation45.png
Change Attribute self.idleAnimation to true
When attribute self.idleAnimation is true
Animate
But then you'd need a way to change self.idleAnimation back to false.
Method 2:
When self.Image=animation45.png
Timer after 0 seconds (run to completion must be checked)
Animate
Run to completion causes the behavior(s) in the Timer to run even if the rule condition becomes false.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Sounds like a plan... will give that a shot tommorow. Thanks tatiang
This didnt work either, it picked up the self.image = certain image do animate. But it still did not animate it just changed the first image in the animation.
Can you post a screenshot of your rules?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Check out this demo.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Still cant get it to work,
Having the rules is helpful but also... did my demo work for you? If your rules are not working, what happens when you test them? I'm assuming you changed something after your original post based on seeing my demo...
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Your last Animate behavior needs to be inside a Timer with run to completion set to true, as I suggested (and demo'ed) above.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Thanks i got it working from the above method works great now. Thanks again
You're welcome.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User