Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This if statement checks if the user wants the player to move left. The conditions for this are that
- # the left arrow key is pressed, the robot's x value is within the minimum boundary (-30) and the right
- # arrow key is not pressed.
- if keys[pygame.K_LEFT] and (roboto.x > -30) and not keys[pygame.K_RIGHT]:
- roboto.movingAnimation("left") # make the robot move left.
- # This elif statement checks if the user wants the player to move left. The conditions for this are that
- # the right arrow key is pressed, the robot's x value is within the maximum boundary (695) and the left
- # arrow key is not pressed.
- elif keys[pygame.K_RIGHT] and (roboto.x < 695) and not keys[pygame.K_LEFT]:
- roboto.movingAnimation("right") # make the robot move right
- else: # if neither of these conditions are met, then the robot will not move and run its idle animation
- roboto.idleAnimation() # run the idle animation
Add Comment
Please, Sign In to add comment