controller help .. this, but not that.

How might you tie a keyboard to a controller and only trigger if a particular key is pressed, but not both, like…

Key UP … moves up.
Key DOWN … moves down.
Key LEFT …moves left.
key RIGHT …moves right.

If key UP and key RIGHT is pressed, then it moves diagonal up and to the right.(we dont want this.)

How would you do… if key up is pressed, but not key DOWN,LEFT, or RIGHT.?

You could use an expression, or Python.
An example expression would be:


W=True and S=False and A=False and D=False

Assuming you call your up, down, left and right sensors W, S, A, D

Well with the correct use of states you could isolate the logic.
So say you set up your key press in the initial state and whenever a keypress happens it sets a new state that has your movement logic for that press. when keyinput becomes false set back to your initial state.

@agoose77: Ahh very good. I haven used expressions, so it didn come to me. Ty.
@Redikann: Using states crossed my mind, but with pressing both keys, I would think it would toggle the states too?

Thx guys.

Ty Monster. Once again, good advice as usual. Tut is well worth the read.

if you set them to tap it will move up and then left ect. no diagnoal movment.