# Using Python, How would I get my player to rotate 180 degrees left or right,

More specifically I want the character to rotate a complete 180 when I press the left or right arrow key. But I don't want it to rotate again if I press the same key in sequence. Example: Character is facing Forward. I Press Left, the model rotates 180 left. I press Left again nothing happens because the model is already rotated (Would be perfect). Ive searched all over web but can't really figure this one out :/ Heres my script

import bge

def main():

cont = bge.logic.getCurrentController()
player  = cont.owner
keyboard = bge.logic.keyboard

if  bge.logic.KX_INPUT_JUST_ACTIVATED == keyboard.events[bge.events.LEFTARROWKEY]:
player.applyRotation((0,1.57,0), True)


Any help will be appreciated thank you!

It sounds like you want a specific (end-) pose rather than a turn. Therefore I suggest to split the operations: Set target pose (turned east or whatever) -> animate towards the target pose until it is reached (the object faces east ). Subsequent turn requests will set the same target pose without visible effect.

In your case you do not want to animate so you can skip the "animation" state:

import bge
import mathutils