I'm stuck trying to change the sprite blitted to the screen (when moving upwards) to a back view of the sprite.
Currently the sprite is just blitted to the white background on each key press at the most recent x and y coordinates and not fluidly moving along the screen (i want to move the sprite continuously on set trajectories, based on arrow key press, like in snake).
This is my first stab at programming anything on python so Leyman's terms if possible!
lead_x_change = 0
lead_y_change = 0
while not gameExit:
for event in pygame.event.get():
if event.type == pygame.QUIT:
gameExit = True
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_LEFT:
lead_x_change = -5
if event.key == pygame.K_RIGHT:
lead_x_change = 5
#above are two snips of code to show the method i'm using to move the sprite
if event.key == pygame.K_LEFT or event.key == pygame.K_RIGHT or event.key == pygame.K_DOWN:
gameDisplay.fill(white)
gameDisplay.blit(spriteX,(lead_x,lead_y))
pygame.display.update()
if event.key == pygame.K_UP:
gameDisplay.fill(white)
gameDisplay.blit(spriteY,(lead_x,lead_y))
pygame.display.update()
lead_y += lead_y_change
lead_x += lead_x_change
clock.tick(60)
pygame.quit()
quit()