Is there a way to use smooth player movement in PyGame? The way I have it the player moves choppy.
Also, is there a way to add a way to make it so you can hold down a button? Right now I have to keep pressing D to make the character move
Code snippit:
clock = pygame.time.Clock()
x,y = 0, 500
dt = clock.tick(60)
speed = 1
if event.type == KEYDOWN and event.key == K_d:
x += speed * dt
elif event.type == KEYDOWN and event.key == K_a:
x -= speed * dt
I have an image but I don't think it's necessary to include that code. I'm new to PyGame so this might be wrong.
I'm coming from LÖVE so that's why I did the * dt thing. It might be wrong though!
Thanks! Any help is appreciated!
Also, is there a way to add a way to make it so you can hold down a button? Right now I have to keep pressing D to make the character move
Code snippit:
clock = pygame.time.Clock()
x,y = 0, 500
dt = clock.tick(60)
speed = 1
if event.type == KEYDOWN and event.key == K_d:
x += speed * dt
elif event.type == KEYDOWN and event.key == K_a:
x -= speed * dt
I have an image but I don't think it's necessary to include that code. I'm new to PyGame so this might be wrong.
I'm coming from LÖVE so that's why I did the * dt thing. It might be wrong though!
Thanks! Any help is appreciated!