Difficulty with event resetting animation over and over

For questions about using Classic.

Post » Sat Jun 26, 2010 1:12 am

So basically, here's the deal: I have an object with a platform movement behavior that holds the place of what would ordinarily be the character. The character is always set to the hotspot of the object, so it looks like he is the one with the platform behavior. This prevents the character's hat and legs from getting caught on the side of backdrops.

My problem is that when I'm trying to set the character object's animation to "Running," the way I have the event set up:

[code:23g5e76m]'Placeholder' is walking: Set 'Character' animation to "Running"[/code:23g5e76m]

means that the character's animation is constantly reset to the first frame of Running, eliminating the showing of the other 2 frames in the animation. How do I fix this? I've tried 'Trigger once while true' and it didn't work. Kindly help. XD
B
4
S
1
G
2
Posts: 54
Reputation: 958

Post » Sat Jun 26, 2010 2:35 am

[quote="joeyapplepi":333lwl71]My problem is that when I'm trying to set the character object's animation to "Running," the way I have the event set up:

[code:333lwl71]'Placeholder' is walking: Set 'Character' animation to "Running"[/code:333lwl71]

means that the character's animation is constantly reset to the first frame of Running, eliminating the showing of the other 2 frames in the animation. How do I fix this? I've tried 'Trigger once while true' and it didn't work. Kindly help. XD[/quote:333lwl71]
If you just switch 'Character' to running, 'Placeholder' stays in the walking state. So this action is called every frame. You could switch the 'Placeholder' state (animation) also , keep track of the state using a global/private variable or test for the current animation of 'Character'.
The latter would look something like this:

+'Placeholder' is walking
[Invert]'Character' animation "Running" is playing-> Set 'Character' animation to "Running"
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Sat Jun 26, 2010 9:34 am

[quote:2imxuqvf]+'Placeholder' is walking
[Invert]'Character' animation "Running" is playing-> Set 'Character' animation to "Running"[/quote:2imxuqvf]

Thanks for the idea. I tried this, but nonetheless, the character's "running" animation stays stuck in the first frame. I don't really understand what the issue is... ._.
B
4
S
1
G
2
Posts: 54
Reputation: 958

Post » Sat Jun 26, 2010 10:14 am

Maybe there's still something else interfering with the animations. It would sure help a lot if you shared the cap.

Other than that there's a pretty easy way to use animations with a dummy sprite. Just give your Dummy (the placeholder) all the animations of your actual character sprite - or rather those that can be tagged. For all those animations use one and the same frame, so the placeholder won't actually change shape or appearance.

So you'd have animations like Walking, Jumping etc. on your dummy and your character sprites. The exact same animation names. Now add the proper tags to the animations of the dummy, which is the object which actually has Platform Behavior. If you don't know about tags they can be set to the left in the properties bar when you click on an animation name. So your jumping animation gets the tag Jumping of course and so on...

Now all you need to do is set the animation of your character to the animation name (sprite.animname) of your dummy in an always event. You can see a setup like this here: [url:19lf0s9h]http://dl.dropbox.com/u/2306601/tut02.rar[/url:19lf0s9h]

Sorry for the german names in the cap, but it's part of a german construct beginner's tutorial I made a while ago.
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests