Game Development Community

Code for extra player movement animations

by Jules · in Torque Game Engine · 01/13/2009 (12:00 pm) · 12 replies

Hi, does anyone know how/where I can add extra player movement animations that are bound to keys? I know you can add key bindings, it's the actual engine code that needs modifying. I'm trying to do the following;

If player is jetting, use A for hover left, D for hover right.
If player is not jetting, use A for side step left, D for side step right (default).

The problem is, when I searched for this code, it uses one animation on the stock players which is either played backwards or forwards. I have seperate animations for hover left and right for my character. so I'd need to factor this in, any help much appreciated.

#1
01/13/2009 (12:41 pm)
Couldnt you play the animation when the key is pressed? and let the computer blend them?
#2
01/13/2009 (1:09 pm)
Not sure, I'll give it a go, might cause a conflict though.
#3
01/16/2009 (3:59 am)
bump
#4
01/16/2009 (7:17 am)
You can find them in player.cc/h
#5
01/16/2009 (10:30 am)
yes, I've seen it there. Maybe I should go into more detail... how is movement defined in player.cc/h and how do you link additional player animations to key movement?
#6
01/16/2009 (10:55 am)
When in air (mContactTimer>0 and mJetting)create a public member in player class that sets true.Else false.
UpCast that member to ShapeBase and next to Player in your camera class.
You need to yaw left on A,yaw right on D.

In camera's processtick,catch D as move->x>0, and A as move->x<0.
Incremect/decrement yaw value on that conditions.
If you use the Advanced Camera code,the idea is a bit different,there you cannot catch move->x,but you can create your own input on A/D and track it down.

I,ve done it in a similar idea,but i am not able to share the code.
#7
01/16/2009 (1:37 pm)
I have kind of the same question, but instead of adding an animation to a button press, I want it to override a previous one. When I use a speed pickup it doubles your speed, is there a way I can have the run animation change when the speed pickup is used and active?
#8
01/17/2009 (9:42 am)
I think the only logic you need to alter is that in Player::pickActionAnimation. Read through the loop where the engine decides which action to use, based on the current velocity and the animation's velocity. You'd want to alter that loop if you're hovering, to use your special hovering animations.
#9
01/17/2009 (9:53 am)
Thanks for the replies. I'll see what I can come up with, but if anyone has done this already and can save me the time, I'd help you out on some 3D Art, or buy you a case of beer for your trouble. You can get me on jross (at) something2play (dot) com.

Edit: was joking about the beer.
#10
01/17/2009 (9:55 am)
@Jeff - I think I've seen where you can do this. I'll get back to you.
#11
01/17/2009 (10:32 am)
Jeff: I've done something similar to what you need, I think. I just made the pickActionAnimation loop dependent on speed as well as direction, and added a 'sprint' animation with a higher speed than the normal move animation. So whenever Players startmoving faster than normal, pickActionAnimation automatically bumps them into the sprint animation.
#12
01/30/2009 (2:17 am)
I used AFX in the end to include special effects with the animations.