Python Forum
Trying to make boundries for the pygame
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trying to make boundries for the pygame
#2
I'd rather not read through all of this code so I'll tell you this.
1. This code is really sloppy, there are lots of tips on making a game with pygame in the pygame tutorials here on this forum, I'd recommend you to go check those out.
2. To keep a player from going outside the screen, it depends on if they're left, right, up, or down, but for up, just check if the second value of they're rect, y-value, is less than 0, if so then set it back to 0. This creates the effect that they can't move beyond the walls of the pygame window.
Reply


Messages In This Thread
RE: Trying to make boundries for the pygame - by SheeppOSU - Mar-22-2020, 10:19 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to make enemy chase me in pygame? Jan_97 3 4,541 Nov-23-2021, 05:08 PM
Last Post: Jan_97
  How to make an image move in relation to another in PYGAME CompleteNewb 1 2,350 Nov-10-2021, 03:38 PM
Last Post: metulburr
  cant make a door automatically close a few seconds after i open it in pygame cooImanreebro 2 2,297 Dec-15-2020, 08:40 PM
Last Post: michael1789
  How can I make music with python/pygame? xBlackHeartx 12 7,368 Oct-15-2019, 08:00 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020