assigning animations to keystrokes

I’ve been stuck on this since yesterday ,there aren’t really
any examples except for the “rockin robots”…
I think i got it last night, by defining,
but i was pretty tired, and need to try it.
I’m on my downstairs computer right now.
( I just tried it upstairs, and it didn’t work.)

Is there a list of secret acceptable demands such as:
[‘forward’] , [‘backward’] ,[cam-left’] or perhaps [‘strike’] :slight_smile:
because i keep getting a [punch] keyerror.

I don’t want to link the punching animation to the
forward movement also, even though that works.
It might be kind of cool to make it do snap kicks if you turn though.
If you turn left he’ll kick and right turn will do a jumping manuever,
and moving forward is just a rain of punches…
HAHAHA I just thought of an idea for a game called
WEAPONS MALFUNCTION , that could also be pretty cool
with this keyboard setup.

“We just dropped him into Beruit with a faulty jammed trigger gun.”
says the evil general, in the cutscene.
“I’ll be the one to live with this decision, because he most certainly will die.”

[EDIT] HAHAHA I forgot to add the

def __init__(self):
   
    self.keyMap = {"left":0, "right":0, "forward":0, "cam-left":0, "cam-right":0, "punch":0}

header… So now it runs a little before it crashes.
I get only two arguments, out of the three needed.
So I’m guessing i need to add a self.isPunch=true,
or something really similar…

[EDIT2] Yup that was it! I have 3 animations now,
but its not very slick…I have to figure out the
release combination, right after i stop running,
now i have to hold down the
k button to stop punching and go into my default resting pose,
but he runs with the arrow keys… So thats awesome.
Now i’m going to figure out how to make a grenade!

[edit43] Now I’m stuck with the animation loops, it seems that if i run
and then stop it will go to my default pose, and if i punch from
there it gets locked into punching , when i should be running,
until i hit the punch key again. Then from there i have to
hold the punch key to show the default animation.
Is there a call instead of ‘loop’ such as ‘play once’?
I read in a post about a loop conflict or something,
luckily i saved it to file so it should pop up again.
I’ll probably have to dig some more.

[Edit 376] Well I still have the animation problem, I think
I might try a destroy command after the punch…
I’ll figure it out unless there’s some bug. I notice my
character starts out running, until I hit the forward and release,
so maybe that has something to do with it.
Right now I’m moving on to getting multiple camera angles,
and thinking of grenades.

You could always use the simple way of having a DirectObject accept each keystroke and play an Event.

self.accept("arrow_up", PLAYER.MoveForward)
self.accept("arrow_up-up", PLAYER.StopMovingFB)

When the up arrow is pressed “PLAYER.MoveForward” is called and when the up arrow is released “PLAYER.StopMovingFB)” is called.

I’m not sure why people are always using the other method. What are the advantages to it?

Thanks man! That looks like a good one with the playerstopfb!
I think its because all the tutorials have “loop” everywhere,
but not anymore for me with the loops hopefully.

now I have to figure out the multi angle camera toggle maneuver,
which is really difficult, I think!

[EDIT] I think I need to have a separate class for the camera,
I was lumping the change camera ‘selfaccepts ‘c’ [change cam]’
with the actor controls, I’m still a little burned out from linking
the normal map, experimenting with custom collision geometry,
figuring out multi terrain, and keystroke animation.
Plus it just started to get chilly this week,
and I’m running around in Bermuda shorts.