Mar-19-2020, 06:04 PM
Tell the program that if your characters edge passes the edge of the screen to reset it to be on the screen. If you are using your pygame rect it is like this:
This video helped me:
https://www.youtube.com/watch?v=Eltz-XJMxuU
character.image = pygame.transform.scale(player, (30,30)) character.rect = character.image.get_rect() if character.rect.right is > width: character.rect.right = widthI encourage you to learn the pygame Sprite class. It will make things a lot easier (like collecting coins) going forward.
This video helped me:
https://www.youtube.com/watch?v=Eltz-XJMxuU