Animation trouble

For questions about using Classic.

Post » Thu Jul 23, 2009 6:29 pm

I've got my 'walking' animations all sorted and groovy and I've set it so that when the sprite isn't moving it changes to the appropriate stationary position that it's facing but I've come across trouble with using any other animation. What I want is for my ninja to animate a seperate animation when pressing X, but because of the whole default stationary programming, it's not playing. Can anyone help me find a way around this problem? Here's a screenshot of the events. F.Y.I. that's the only programming in the game thus far.
[url:2mzpjc0u]http://i3.photobucket.com/albums/y78/Omen6/problem.jpg[/url:2mzpjc0u]
B
1
G
3
Posts: 6
Reputation: 837

Post » Thu Jul 23, 2009 6:37 pm

Your "On key X Pressed" event only triggers one time when you press the key. Then the event sheet starts over again, and you're setting your animation to something else in the very next tick.

You need to, um... not do that. Sorry, I'm getting very lazy with my Help replies lately.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Thu Jul 23, 2009 9:14 pm

Can anyone elaborate on that? I understand it but don't know how to bypass it. I had an idea of triggering a timer on pressing X as well and then having a sort of 'while the timer's going, play keep the animation going' type event, but as far as I know, that's not any sort of in-construct event command xD
B
1
G
3
Posts: 6
Reputation: 837

Post » Fri Jul 24, 2009 10:33 am

I have a feeling that the Else statement is screwing you up. Let's see what happens:

- checks if walking, plays the walking animation
- then if the above fails, it plays standing animation
- now check for key pressed, in this case it starts another animation

After one tick, it checks those events again, but the "key pressed" already triggered in previous trick, so it won't trigger in this one. Meanwhile, the above two events had triggered already, resetting the animation to either one. So, your X animation only plays for one tick.

I suggest replacing the Else event with this (right click the condition to invert it):
+ is NOT walking
+ X-animation is NOT playing
> play idle animation

Also, you might want to add the "X-animation is NOT playing" condition in walking animation event, too.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Fri Jul 24, 2009 4:20 pm

Yeah, what Mipey said.


*dusts off hands* Welp, my job is done here.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Fri Jul 24, 2009 7:09 pm

Your job should be done, but it isn't xD In theory this should work...but it doesn't :/ This is my new code.
[url:1x1417ig]http://i3.photobucket.com/albums/y78/Omen6/problem2.jpg[/url:1x1417ig]

Once more, it begins, but then hangs after the first frame.
B
1
G
3
Posts: 6
Reputation: 837

Post » Fri Jul 24, 2009 8:49 pm

Try this for event 4:

NOT Player: Animation "Animation 2" Is playing
NOT Player: Animation "Animation 1" is playing
Player is walking
action: Set animation to "Animation 1"

Because, this:
NOT Player: Animation "Animation 2" Is playing
Player is walking
action: Set animation to "Animation 1"

is going to constantly set the animation to Animation 1, starting from its first frame, no matter whether Animation 1 is playing already or not.
Basically, you want to check that the animation you intend to play is not playing already.

At least that's how I understand it, and that is how I am doing it.

Likewise for your next event, you will probably want:
NOT Player: Animation "Animation 2" is playing
NOT Player: Animation "Default" is playing
NOT Player is walking
action: Set animation to "Default"

I think that might be what Mipey meant. :)

You may want to do similarly for event 6, On key X pressed, depending on what your animation does.
B
3
S
1
G
3
Posts: 82
Reputation: 1,189

Post » Mon Jul 27, 2009 2:50 pm

I'm afraid it still doesn't work :/ It now continually plays the walking animation and plays the X animation and then sticks.
B
1
G
3
Posts: 6
Reputation: 837

Post » Mon Jul 27, 2009 9:48 pm

try a state machine with a private var defining current state and animate according to that state
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Tue Jul 28, 2009 6:53 am

Yep, finite state machine. Give the ninja a private variable 'state', then set it to whatever the ninja is doing - "walking", "standing", "pickingnose"

Then you just compare that variable and play an set an according animation.

Finite state machines make game development much easier. ;)
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests