Problems with changing an animation

Non-platform specific questions.

Problems with changing an animation

Postby msv83 » Thu Mar 13, 2008 11:25 am

The character in the game I'm making changes animation depending on action (run forward, run backward, stop right, stop left, jump right, jump left, shoot right, shoot left), but I have a problem making the jump and shoot animations stop.

When the character is running forward, and I press the space bar (which is the "jump" button), the character changes into the jump animation, but I can't make it change back to the normal running-animation when it hits the ground. So if I, after having pressed the jump button, doesn't release the forward button, the character keeps going forward, but keeps the jump animation...

Sorry if I'm making this a bit confusing...

But what I'd like to do, is make the character change back to the forward (or backward) animation when it hits the ground again. Or when it's about to land, it doesn't really matter...as long as it just keep running normal when it's back on the ground. I tried some animation finish and timers, but none of them worked so I guess that's either not the way I can do it, or I did it wrong.

Any ideas? :)
msv83
 
Posts: 22
Joined: Mon Dec 31, 2007 3:17 pm
Score: 0 Give a positive score

Re: Problems with changing an animation

Postby edh » Thu Mar 13, 2008 1:32 pm

What if you store the previous animation, and when you collide or end your jump animation, restore the previous animation?

Actually, that may not even be right, maybe your events are a little messed up?

You've got key-down + collide with the ground for running whichever way.
If you're not colliding, you're jumping, right?
User avatar
edh
 
Posts: 233
Joined: Thu Sep 13, 2007 12:17 am
Location: Maine, USA
Score: 14 Give a positive score

Re: Problems with changing an animation

Postby jlorinser » Thu Mar 13, 2008 5:12 pm

Hi MSV83,

Have you tried this:

If the character's animindex value is equal to your "jump left" or "jump right" animation when colliding back with the ground (after the jump), change the animation to running left or right depending on the direction it jumped (the animindex of the jump).

Hope it helps!
jlorinser
 
Posts: 11
Joined: Mon Feb 05, 2007 5:38 am
Score: 1 Give a positive score

Re: Problems with changing an animation

Postby msv83 » Thu Mar 13, 2008 8:30 pm

Thanks for trying to help me out, both of you :)

I'm probably a bit too much of a newbie in all this to really understand the suggestions you are giving me... :oops:

The collisions I have for the ground, are these:

collision - top side of ground - script editor - "canjump=1;"

physical response - any side of ground - the settings 1, 1, 0 and 1...
msv83
 
Posts: 22
Joined: Mon Dec 31, 2007 3:17 pm
Score: 0 Give a positive score

Re: Problems with changing an animation

Postby msv83 » Thu Mar 13, 2008 10:41 pm

There are some other topics regarding the same problem I've got (none of them seems to have been solved though), and they might explain it a bit better than I do...

http://game-editor.com/forum/viewtopic.php?f=4&t=1772
http://game-editor.com/forum/viewtopic.php?f=1&t=2010
msv83
 
Posts: 22
Joined: Mon Dec 31, 2007 3:17 pm
Score: 0 Give a positive score

Re: Problems with changing an animation

Postby edh » Fri Mar 14, 2008 6:13 pm

I'm still thinking about this one... :|
User avatar
edh
 
Posts: 233
Joined: Thu Sep 13, 2007 12:17 am
Location: Maine, USA
Score: 14 Give a positive score

Re: Problems with changing an animation

Postby j2graves » Sat Mar 15, 2008 8:13 am

aren't there animation finish events?
No games to my name...
User avatar
j2graves
 
Posts: 1302
Joined: Thu Aug 16, 2007 6:42 pm
Location: on the other side of infinity
Score: 19 Give a positive score

Re: Problems with changing an animation

Postby edh » Sat Mar 15, 2008 9:27 am

@j2graves, yes there are. It's a good idea. I was going to suggest that too, but you don't actually want an animation finish, I think - I could be wrong. I think you want to change the animation on collision because you could collide before your animation finishes the jump action. And you wouldn't want the actor to switch to running in mid air, either.
User avatar
edh
 
Posts: 233
Joined: Thu Sep 13, 2007 12:17 am
Location: Maine, USA
Score: 14 Give a positive score

Re: Problems with changing an animation

Postby msv83 » Sat Mar 15, 2008 5:58 pm

Hm...seems to be a hard one, this one... :|

I've been thinking about key up event, but that doesn't work very good since the character moves both to the left and to the right, and there's two different jump animations...
msv83
 
Posts: 22
Joined: Mon Dec 31, 2007 3:17 pm
Score: 0 Give a positive score

Re: Problems with changing an animation

Postby DilloDude » Sat Mar 15, 2008 10:13 pm

What you need to do is have variables with the current state: wether you are walking or not, which direction you are facing, and wether you are in the air or on the ground (you probably already have this). This makes a lot of things simpler. Then in draw actor, you just check those variables to figure out which animation should be playing, and change it if necessary.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Re: Problems with changing an animation

Postby msv83 » Sun Mar 16, 2008 3:02 pm

Thanks! Just one thing...how should I do this? I'm afraid I'm still very inexperienced and don't really know how to do exactly that step by step... :oops:
msv83
 
Posts: 22
Joined: Mon Dec 31, 2007 3:17 pm
Score: 0 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron