Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 [PyGame] assigning rect to sprite
#1
I've hit a brick wall .
How do I assign a rect attribute to a sprite . I'm out of ideas .
I'm using pygame.
This is the line of code I'm using to do this but it doesn't work. Could somebody show me a piece of code to do this .

Quote:image1_rect = image1.image.get_rect(topleft(x,y))

Thankyou
Quote
#2
im not sure what your image1 is versus image? But you would do

image = pygame.load.image('imagename.png')
rect = image.get_rect(topleft=(0,0))
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  [PyGame] Sprite image.get_rect() moves sprite to 0, 0 michael1789 2 186 Dec-13-2019, 08:37 PM
Last Post: michael1789
  rect object not loading BlueClaw 2 2,004 Dec-11-2019, 04:25 PM
Last Post: BlueClaw
  [PyGame] pygame.draw.rect function stretches across the screen instead of moving BubblesTheGiraffe 2 737 Jun-11-2019, 08:32 PM
Last Post: metulburr

Forum Jump:


Users browsing this thread: 1 Guest(s)