I'm trying to make a simple shooting game with a pygame, but I'm curious. Pressing the direction key made the shape move. Here, if you press the right direction key first and the left direction key, how can you move to the right at a lower speed than the right direction key? here is my origin code
while True:
clock.tick(60)
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
pressed=pygame.key.get_pressed()
if pressed[pygame.K_LEFT]:
player_left=1
pos_x -=6
if player_left==1 and pressed[pygame.K_RIGHT]:
player_left=0
pos_x-=3