How to make proper key combination animations with or without Python

I’m trying to make a game (I’ll leave a link to the upload in this post later on) And I’m not at the programming or level design part. Right now, the ONLY thing I’m trying to get out of the way entirely is the control setup for the player character. I need to have him fully movable and navigable with all animations working as they should so that further development will be much easier, plus, it’d be a lot more fun.

The problem is that I’m a complete idiot when it comes to Python, and a novice with Logic Brick. I know my way around Logic Brick, but I’d barely consider myself a master. My issue is organizing certain motions and animations to be either true or false depending on the condition the character is in at the time. For example, my player can double jump, but I can’t get the second jump to play AFTER the first one, nor can I get them to stop after they have already been pressed, nor can I get the falling and landing animations to play at their respected times. (If there is a way to do this with floor/player properties, please explain, as I don’t quite know how they work)

I also have a similar problem with the double punch animations. When I hold the punch key, they punch animations play over and over again, and no matter how I set the “priority” of the animations, the second punch is so stubborn, it won’t play AT ALL unless it has a higher priority than the first punch animation. If there is a way to do this with or without Python, I would like for someone to show me, or if this can be done using logic nodes, or tell me if there is an ad on that can do what I’m trying to do, provided that I input the correct keys in place.

PS: If there’s anyone out there who’s a genius at this sort of thing, and/or is god enough with Python to navigate me through this, I would be super happy if you were to tutor me via Google Hangouts.

import bge



def main():


    cont = bge.logic.getCurrentController()
    own = cont.owner
    ray = cont.sensors['Ray']
    space = cont.sensors['Space']
    
    
    #rising animation state
    if own['Jump']>0 and own['Jump']<=9:
        own['Jump']+=1
    
    
    #begin fall state
    if own.worldLinearVelocity.z<0 and own['Jump']>0 and own['Jump']<11:
        own['Jump']=11
        
    # animate fall state    
    if own['Jump']>=11 and own['Jump']<=19:
        own['Jump']+=1
    
    #begin landing state
    if ray.positive and own['Jump']>=3 and own['Jump']!=0 and own['Jump']<22:
        own['Jump']=21
    
    #play landing
    if own['Jump']>=21 and own['Jump']<=24:
        own['Jump']+=1
    
    
    #reset actor on landing
    if own['Jump']>=25 and ray.positive:
        own['Jump']=0
               
               
    # start second jump                         
    if own['Jump']>=9 and own['Jump']<21:
        if space.positive:
            own['Jump']=26
            own.worldLinearVelocity.z=0
            own.applyForce((0,0,600),0)
            
            
    # play second jump animation        
    if own['Jump']>=26 and own['Jump']<=35:
        own['Jump']+=1
        
    #begin second falling animation
    if own.worldLinearVelocity.z<0 and own['Jump']>25 and own['Jump']<=36:
        own['Jump']=37
    
    #play falling animation 2            
    if own['Jump']>=37 and own['Jump']<47:
       own['Jump']+=1        
    
    
    #begin landing state
    if ray.positive and own['Jump']>=26 and own['Jump']!=0 and own['Jump']<=48:
        own['Jump']=21
    
       
main()



Attachments

2_jumps.blend (423 KB)

Thank you very much! Could you please explain what’s going on, and where each of my own names for various things will need to go in order for this to work? And of course, which numbers I am free to play around with.

grab the .blend :smiley:

press space

this only marches numbers at the moment, but you can use

if jump!=0----------------and---------------Jump animation in property mode (jump)

I know it works because I use something similar here

So just to make sure I have you understood, the process in my case goes as follows.

  1. The Motion actuator would be changed to an action actuator for the first jump animation.

  2. Do I assign a landing animation to the false property logic brick?

  3. Where does the action for the double jump animation logic brick get assigned to?

I don’t know how to use Python, so just so that I increase knowledge, could you run me through this script and explain what you have written and why? I used to use states to try and accomplish all this, and it failed miserably.

Now, I’ve still got a problem with the punch animations. I can’t get the chain to animate correctly, and I still can’t get the running animation to stop when I hold the run key in the air. Have you ever played the Spider Man game for the Nintendo 64? I know there are other examples, but this is the first that comes to my mind when explaining this. Here are 2 attributes.

 1. When you punch, you can't continuously keep punching by holding down the punch key, you would have to let go and press it again. And this was the case, even if you pressed it and caused a chain. If at any point in the chain, you decided to hold the punch key, the chain would break . The only times this won't happen are in special games where holding the specified key at a certain time plays a different animation/technique.

 2. Each time you press the same key, the next punch animation in the chain would play until you reached the end of it. For example, pressing the punch button once would play a punch animation with the right hand, then again would play an animation with the left hand, and again would play a special animation or something. This process would work for about 4 times of you pressing the specified punch button,and the same goes for the kicking button. And of course, there is a timer for when the next key can be pressed, otherwise the chain would be broken if you wait too long before pressing the button again.

I got the method I attempted to use from this tutorial, and as you can see, I now realize that it can only really work for double tapping if you HOLD the second key.

Also, you seem like you know everything about what to so here, so could you be my personal tutor? I don’t know jack about Python. Where do I need to go to start learning? Should I learn Python from scratch? is there a special learning curve with Python that is exclusive to Blender? I was watching a list of tutorials from a guy named Bucky Robert. If Learning Python from the bottom on up is what I need to do, then please teach me, or direct me to where I need to go in order to know what I need to know to program in Blender. Thank you.

we have

physics hitbox (invisible)
Armature or sprite actor parented to the hitbox

moving the hitBox while playing a animation is acting.
for instance walking = push box, and play animation at rate box moves.

The property jump, is the animation frame of the jump animation.

Checkout the action actuator in property mode using the property jump as the property.