global x_balken | global x_balken | ||||
global y_balken | global y_balken | ||||
x_balken=25 | x_balken=25 | ||||
y_balken=200 | |||||
y_balken=215 | |||||
width = 50 | width = 50 | ||||
height = 20 | height = 20 | ||||
return pygame.Rect(x_balken,y_balken,width,height) | return pygame.Rect(x_balken,y_balken,width,height) | ||||
keys=pygame.key.get_pressed() | keys=pygame.key.get_pressed() | ||||
if keys[pygame.K_a]: | |||||
if keys[pygame.K_LEFT]: | |||||
speed_balken[0]= -1 | speed_balken[0]= -1 | ||||
if keys[pygame.K_d]: | |||||
if keys[pygame.K_RIGHT]: | |||||
speed_balken[0]= 1 | speed_balken[0]= 1 | ||||