Ok pretty new to python scripting i have followed a tutorial to wright a movement script witch works just fine. I would like to add my own command to add a sort of hover effect to continuesly run , but i cannot figure this , here is my code so far , any help would b appreciated.
import bge
def main():
cont = bge.logic.getCurrentController()
player = cont.owner
keyboard = bge.logic.keyboard
wKey = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.WKEY]
sKey = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.SKEY]
aKey = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.AKEY]
dKey = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.DKEY]
wRel = bge.logic.KX_INPUT_JUST_RELEASED == keyboard.events[bge.events.WKEY]
always = True
moveSpd = 0.1
rotSpd = 0.040
drift = 150
upForce = 0.10
player.applyForce((0, 0, upForce), False)
if wKey:
player.applyMovement((0, moveSpd, 0), True)
elif sKey:
player.applyMovement((0, -moveSpd, 0), True)
if aKey:
player.applyRotation((0, 0, rotSpd), True)
elif dKey:
player.applyRotation((0, 0, -rotSpd), True)
if wRel:
player.applyForce ((0, drift, 0), True)
main()