Hi,
There seems to be a simple problem and I can’t see what it is I could be missing. I want a function called when the up, left and space keys are pressed, but this doesn’t happen. The weird thing is that the function is called when the up, right and space keys are pressed, some code:
#input tests:
self.in_game_key_map={"front":0, "back":0, "left":0, "right":0, "up":0, "down":0, "jump":0, "wheel-in":0, "wheel-out":0}
#accepts:
self.accept('arrow_up', self.set_mot_flat_keyz, ["front",1])
self.accept('arrow_down', self.set_mot_flat_keyz, ["back",1])
self.accept('arrow_right', self.set_mot_flat_keyz, ["right",1])
self.accept('arrow_left', self.set_mot_flat_keyz, ["left",1])
self.accept('arrow_up-up', self.set_mot_flat_keyz, ["front",0])
self.accept('arrow_down-up', self.set_mot_flat_keyz, ["back",0])
self.accept('arrow_right-up', self.set_mot_flat_keyz, ["right",0])
self.accept('arrow_left-up', self.set_mot_flat_keyz, ["left",0])
self.accept("space", self.set_mot_flat_keyz, ["jump",1])
self.accept("space-up", self.set_mot_flat_keyz, ["jump",0])
def set_mot_flat_keyz(self,key,value):
print("GOT?: ",key,value)
What could I be missing? It’s strange that if you press up+right+space on your keyboard, the function is called, but if you press up+left+space, instead, the function is not called. Why is it only working for that one combination of 3: up+right+space?
Just press up+right simultaneously, then tap the space button to see a message on the console. Now try pressing up+left simultaneously instead and try tapping the space button, nothing is printed out…
(It works for each individual key presses as well as any combination of 2.)
Thanks in advance.