I was making a 'wasd' movement test in pygame, Every one uses keyboard controls for movement and if you hold down it keep moving until pygame.KEYUP
, But I Need To Press multiple times to just move in the spot that i want(instead of holding like in minecraft), CODE:
class Car(pygame.sprite.Sprite):
def __init__(self, x,y):
super(Car, self).__init__()
...
self.rect.x = 0
self.rect.y = 0
def move(self, x,y):
self.rect.x += x
self.rect.y += y
Keyboard key detect:
if event.key == pygame.K_w:
# car = Car(x, y), steps = 3
car.move(steps, 0)
# Same^ to the 'a,s,d' key
what i'm doing for now is pressing the keyboard multiple times instead of holding(What i want to do), and how I do that?