Guest User

Untitled

a guest
Jun 20th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. # This if statement checks if the user wants the player to move left. The conditions for this are that
  2. # the left arrow key is pressed, the robot's x value is within the minimum boundary (-30) and the right
  3. # arrow key is not pressed.
  4. if keys[pygame.K_LEFT] and (roboto.x > -30) and not keys[pygame.K_RIGHT]:
  5. roboto.movingAnimation("left") # make the robot move left.
  6. # This elif statement checks if the user wants the player to move left. The conditions for this are that
  7. # the right arrow key is pressed, the robot's x value is within the maximum boundary (695) and the left
  8. # arrow key is not pressed.
  9. elif keys[pygame.K_RIGHT] and (roboto.x < 695) and not keys[pygame.K_LEFT]:
  10. roboto.movingAnimation("right") # make the robot move right
  11. else: # if neither of these conditions are met, then the robot will not move and run its idle animation
  12. roboto.idleAnimation() # run the idle animation
Add Comment
Please, Sign In to add comment