Hey,
I have two animations. Idle and Walk. And I want to “play” Idle always, and when pressed “w” the character will start walking and playing walk anim. Well it is working for a first time. Meaning, when I start game, idle anim. is playing, when I press w, walk is playing. But as soon as I stop pressing (holding) w, he freezes on last frame of walk anim. So idle anim. is not playing, and when I press w again, he is just moving, not playing animation.
Here is the .blend: purple.blend (3.28 MB)
You are trying to drive the idle animation with a keyboard sensor with no keys. That only fires once at the start of the scene so it never fires again.
The following changes will get your animation working correctly and also add some blending so that the character “jumps” less when the animation changes. Note that you do have some odd issues where it appears that your walk animation has a different scale than your idle animation.
Attachments
I think I have quite similar problem.
While I press one single button (“A” for left or “spacebar” to jump) everything works nicely.
When I try to press 2 keys at the same time (example: “A” to move left + “spacebar” to jump) my animations get stuck and won’t reset before starting it all over… (the attachment panel couldn’t upload my .blend for some reason, made screenshot)
So, Now I would like to know how to use “jump” animation, too, when I press “spacebar + left or right”.
EDIT: Fixed the jumping problem by adding collision checking to it. Would still appreciate if anyone would know other way to do since now I must apply that property to all my platform objects.And as I’m already here, I could also ask: How to make my character always jump the same distance upwards? Currently I need to hold spacebar to achieve the maximum distance. So what I would need is that by pressing “spacebar once” my character would jump the same distance always. (Off-topic, sorry.)
Attachments
Thx kastoria.
And when I add run animation? How do I set priorities? Because I have same problem now. I have idle, walk, and run.
In the “Action” actuator, there is a field called “priority”. This is just a number and I think it goes from 0 to 100 (maybe higher). The lower the number, the more priority an action has.
You should make your idle action have a high priority (like 100) so that if any other action is trying to play it will get overridden. Your run/walk animations can be the same priority because they are triggered by key presses and won’t be running at the same time.
I think you should turn off the ‘continue’ checkboxes on all the actions. That way, the entire action plays from the start each time you trigger it.
And as I’m already here, I could also ask: How to make my character always jump the same distance upwards? Currently I need to hold spacebar to achieve the maximum distance. So what I would need is that by pressing “spacebar once” my character would jump the same distance always. (Off-topic, sorry.)
That depends on how you are getting the character to move. If your jump height just an animation, then setting it to play on ‘loop end’ with a lower priority number than your walk or run should let it finish execution.
I would try giving all the actions a different priority with idle being the highest number, then walk, then run, then jump.
Turning off continue didn’t help, but it surely made my animations look much better so something good atleast
Must try to go deeper in google to get solution to my problem still …
I feel like a total idiot now.
I just gave my “jump” animation more priority so it overrides the “left or right” commands.
Now that I jump it keeps doing the jump animation no matter if I keep pressing “a” or “d”. Working the right way now.
There are still some minor things to do but I think I will get them work later on.
I would not use priorities at all. It makes the whole structure pretty clumsy as it is not easy to see what should be played.
I suggest to activate the necessary actions at the right time and deactivate it when not necessary anymore (e.g. when another one should be played).
There is no need to play a standing action while jumping or running.
And how to make that? Because I’ve tried to make it like you said kastoria, but… not really working. Have a look: player.blend (3.68 MB)
The best way would be to use states.
I say would because since 2.62 there are a few pretty annoying bugs in the action actuator that prevent them to deactivate the actions properly. The result is that after some animations the actions are not played at all. I hoped it is fixed but it is not :(.
My solution is to use exactly one action actuator and set the according configuration via Python. This is fine in an environment with a lot of animations (e.g. adventures) but to much overhead when just using a few.
Well, python is not my strong side, but I’ll try, and post the result. Thanks
Yeah, I must agree too that my python skills are too bad for code writing.
Is there a way to tell animation only to play in certain areas (in my case at one specific platform) with only using logic bricks?
I already know how to make certain movement work in specific areas but not quite sure yet about animations…