Discord
Login
Community
DARK THEME

disable the input recognition of wsda when presing the UP,DOWN,LEFT,RIGHT

hello, new to this engine... I've been trying to make a 2 player game but I have ran in to a problem due to the fact that when I use

#python btw
def checkInput(obj,val):
  if hasattr(obj,val):
    return obj[val] != 0
  return 0

def update():
  global x,y
  if checkInput(keyboard,"LEFT"):
    x = x-1
  if checkInput(keyboard,"RIGHT"):
    x = x+1
  if checkInput(keyboard,"UP"):
    y = y+1
  if checkInput(keyboard,"DOWN"):
    y = y-1
  pass

it detects the inputs from WSDA as well. so is there a way to disable this behavior?

Just use keyboard["ARROW_UP"], or, in your example, checkInput(keyboard,"ARROW_UP"). Same for DOWN, LEFT, and RIGHT :D

thanks I'll try that

edit: I't worked

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community