chaeMil
(chäeMil)
October 19, 2010, 8:46am
1
hi i have the player script in game and i’m using this:
W = cont.sensors["W"]
S = cont.sensors["S"]
if W.positive or S.positive:
do something....
and i want to use the bindable controls… is there any way to simulate something like W.positive?
PS i dont want to connect all the sensors so i will apreciate something to use the keyboard sensor with the allkeys enabled…
thanks for your help…
Monster
(Monster)
October 19, 2010, 9:23am
2
see the BGE API . Look for getKeyStatus
Other options:
def keys(cont):
event = cont.sensors["sKeyAll"].events[0] #checks first pressed key only
if event[1]==1 or event[1]==3:
key = event[0]
if key==GameKeys.TWOKEY:
if event[1]==1:
print ("pressed"+str( key ) )
I hope it helps
chaeMil
(chäeMil)
October 19, 2010, 10:46am
3
i’ll try this but i think it will be complicated if i want to save the player controls to config file… anyway thanks