Hello all!
I have developed a movement script for those who like much more effective means of character control. All I ask is that you give me credit. If credit is not given - I will find you.
Instructions:
This script is extremely easy to implement.
- Created keyboard sensor named anything you want.
- Create a controller that has the script attached to it.
- Create a actuator named “Motion”.
- You are done
#Coded by: HyperReal
#Version: 0.1
import bge
from bge import logic
from bge import events
cont = logic.getCurrentController()
motion = cont.actuators['Motion']
key = logic.keyboard.events
WKEY = key[events.WKEY]
AKEY = key[events.AKEY]
SKEY = key[events.SKEY]
DKEY = key[events.DKEY]
yMove = 0.0
xMove = 0.0
if AKEY == 3:
xMove = 0.0
if DKEY == 3:
xMove = 0.0
if AKEY == 2:
xMove = -0.1
if DKEY == 2:
xMove = 0.1
if AKEY == 1:
xMove = -0.1
if DKEY == 1:
xMove = 0.1
if WKEY == 3:
yMove = 0.0
if SKEY == 3:
yMove = 0.0
if WKEY == 2:
yMove = 0.1
if SKEY == 2:
yMove = -0.1
if WKEY == 1:
yMove = 0.1
if SKEY == 1:
yMove = -0.1
motion.dLoc = [xMove, yMove, 0.0]
cont.activate(motion)