# Rotate character to direction of key press, and begin walking

'Ello, again
Sorry to bother everyone (again), but I’m having another problem
Before I start though, if anybody knows a place (web page, wiki, etc.) where I can learn more about the Blender GE, please post that, it just seems I don’t know enough about Blender (or it’s GE…) to be making this kind of game, but I find it difficult to locate the proper resources online, which I usually tend to do before asking a question about it (like when I was learning C++, there were looots of resources on it online, making it [usually] easy to figure out how to do something).
Okey on to my issue: Typically when anyone in real life is turning… oh how about left, they don’t stop in place and begin rotating in place until they’ve turned left and then begin walking again, they just turn left and start walking. I wanted that in my game, but I didn’t know how to do it at first. I tried making a new Integer, where different values meant different directions (0=forward, 1=forward/left, 2=left, 3=backwards/left, etc. etc…), and did a little research to learn how expressions work in this case (I had tried different varitions of writing out an if() statement, but it turned out I didn’t even need the word ‘if’ in there, lol). Then I turned on my common sense and decided a string would be easier to use, so I changed it to that.
So at first the string is equal to “forward”, but if you press the ‘LEFT’ key on the D-Pad, I want the player to be rotated the proper amount, the Direction property be equal to “left”, and for as long as the player is holding down the left key, the charafter is moving left (although technically forward, just has been rotated 90 degrees counter-clockwise). I ended up with a complex setup, where if you press the left key like 3 or more things happening at once, including idle being equal to false, walking (another property) being equal to true, the character rotating once, and then then the character begins walking forward. I got confused, real quick. Is there an simpler way to do this, or is this basically how I have to do it?
P.S. if I could use python to make the character simply rotate to forward (0 degrees), forward/right (45 degrees), right (90 degrees), etc. depending on what key/keys are pressed, I would MUCH rather use that instead, so if you know how to do something like this using Python, please say so. Of course you don’t have to actually give me the code, just do what my friends at Rohitab do (lol…): give me some hints, maybe a few functions I might not know, and I look up the rest

Thanks for reading, hope someone can help

make the armature and guy non-dynamc, ghosts and parent the armature to a dynamic, non-ghost bounding box

usualy this happens because two things are overlapping, so they try to get appart from eachother. but they are parened together so they cant and they just go crazy! lol

so if you have a boundng box handle collsions and the guy and armature in the middle just looking pretty it all works out =P

Thanks! Just one question:
“…and parent the armature to a dynamic, non-ghost bounding box”
Great idea! a question though, how do I make the box invisible? And does the size of the box necessarily matter?

invisible,
in the editing buttons you will see a box labled texture face if you press “u> unwrap” (while in edit mode)
make sure you have an active face by manualy selecting a face, then just check invisible and copy draw mode to apply invisible to all the other selected faces (ctrl+c>active mode)

size,
doesn’t matter really, the closest it is to the size of your character the better, you can also make it any shape you want (most professional games use hexagonal prisms with beveled tops i think)

Thanks you very much! I can’t wait to try it out

Can someone make a tutorial about this? I mean a step by step tutorial in making a game in Blender. Even the simplest ones of any genres (not just the maze game) will be a great resource for noobs I think.

oto’s tutorial is the one i learned on, its in the first post, but i think its outdated now with 2.46

it’s somewhat outdated, but it still works, as most (AKA almost all) of what’s in the tutorial can be duplicated in 2.46

Cool, I’ll start right away.

the only thing that is outdated i think will be the textring part, they moved io edit mode instead of pressing “f”

Sorry, but I have another question. How would I increase the friction of the invisible box while sliding over a solid object?

You must increase the friction of the ground. Go into the materials tab and hit DYN (below the color sliders)

Restitution = Bouncyness
Friction = well… friction
I can’t remember what other slider there was =/
If you set friction at .6 it gives a good result. Don’t touch the friction of your player though!

Hello
maybe use an “always actuator” for the “stand” action?!
You must use the “blendin” settings, maybe?!
Bye

Huh, that’s good idea! Is there any chance it’ll interfere with the animation, since it’s “always” trying to set the animation to a certain frame?

Simply hit the inverse button on the keyboard sensor.

not really either. The inverse button, i think, checks for when the button is RELEASEd, not really while it’s not pressed.

if i get the q, you wanna know how to set it so when your not pushing up, he goes back to his neutral pose (just fyi, this animation is often called ‘idle’ or ‘breathe’). if so, make the up sensor like you have it, and set the walk animations priority to say, 3. then make an always, and, action set up, with the action being idle, with a priority of five. since the walks priority is lower, it will overide the idle animation for as long as the up key is pressed. i hope this makes sense

edit-- oops, missed what oto said my bad. hope this clears things up tho

I don’t know if this is what OTO said, but you could also always play an idle animation except for when you press walk button.

ya, that’s what he was gettin at i think.

Thanks for the help, really appreciated!

For a little while I was still having a problem with it, but then I noticed that I still had the Inv[erse] button pressed, so it was actually NEVER going to the idle frame, lol…