As you move the player, you change the playerx
and playery
variables. However, the player id drawn to the position that is stored in player_location
. You must update player_location
before drawing the player:
while True:
screen.fill((4, 124, 32))
player_location = [playerx, playery]
screen.blit(player_image, player_location, player_rect)
# [...]
Note that you don't need player_location
at all. Draw the player at [playerx, playery]
:
while True:
screen.fill((4, 124, 32))
screen.blit(player_image, [playerx, playery], player_rect)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…