مثلا زر W
وزر A
هذاالكود الخاص بي:
def keyPressed():
qw()
qe()
def qw():
global player_1_y
old_y_player_1 = player_1_y
if keyboard.keyCode == UP:
player_1_y = player_1_y - 50
if keyboard.keyCode == DOWN:
player_1_y = player_1_y + 50
if player_1_y < 0 or player_1_y + 50 > height:
player_1_y = old_y_player_1
def qe():
global player_2_y
old_y_player_2 = player_2_y
if keyboard.keyCode == LEFT: