Python Forum
[PyGame] Surface and rectangle in pygame
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyGame] Surface and rectangle in pygame
#6
(May-14-2023, 01:53 PM)Fabrizio_fg Wrote: but when i have to move the object we move only the rectangle, what it means?
We move only the rectangle, and the surface? Remain in the original position?
There is a way to combine thi two object and move them with a command?
But first of all why we create a surfaces for a rectangles? we cant' t create a big surface with the dimension of the window and on this big surface create rectangles?
Rectangle is use to position the surface. It just uses the x and y.
Rectangle is also use for collisions.
Surface can be use over and over again. Just set a new position.
Why cant you have big surface ? You can a bigger surface than the screen.

Tip. Take it one step at a time. Add one line of code. Run it. To see how it effect program.
99 percent of computer problems exists between chair and keyboard.
Reply


Messages In This Thread
Surface and rectangle in pygame - by Fabrizio_fg - May-14-2023, 01:53 PM
RE: Surface and rectangle in pygame - by Phidias618 - May-14-2023, 07:29 PM
RE: Surface and rectangle in pygame - by deanhystad - May-15-2023, 03:28 AM
RE: Surface and rectangle in pygame - by Phidias618 - May-15-2023, 07:34 AM
RE: Surface and rectangle in pygame - by deanhystad - May-15-2023, 02:36 PM
RE: Surface and rectangle in pygame - by Windspar - May-15-2023, 08:36 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyGame] Pygame is treating blob_group as a surface, when I need it to treat it as a Sprite. Swagford 1 1,405 Jan-24-2023, 09:58 PM
Last Post: metulburr
  Coloring a surface with transparency Sandor 4 2,444 Jan-02-2022, 08:11 AM
Last Post: Sandor
  Rotating a rectangle CompleteNewb 19 14,065 Aug-28-2021, 03:23 PM
Last Post: CompleteNewb
  Make rectangle snap to other rectangle corners Pedroski55 2 4,481 Aug-13-2021, 09:59 PM
Last Post: Pedroski55
  Drawn line shift when that surface is copied to another in pygame Leo_Red 4 3,451 Feb-11-2021, 06:33 AM
Last Post: Leo_Red
  [PyGame] pygame.Surface.fill help Shemira 3 6,318 Nov-29-2019, 12:01 AM
Last Post: Shemira
  pygame.surface Graham 10 8,667 Nov-29-2018, 04:45 PM
Last Post: nilamo
  [PyGame] Rectangle keeps teleporting? keyfive 1 3,294 Jun-27-2018, 11:49 PM
Last Post: sonnekrieger7
  [PyGame] PLEASE HELP! TypeError: unsupported operand type(s) for +: 'pygame.Surface' and 'int' keyfive 1 5,395 Jun-19-2018, 01:20 PM
Last Post: volcano63

Forum Jump:

User Panel Messages

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