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
  Sprite not rendering Clunk_Head 2 90 Oct-03-2019, 11:27 AM
Last Post: Clunk_Head
  Need help making a sprite GalaxyCoyote 4 351 Aug-11-2019, 09:12 PM
Last Post: metulburr
  [PyGame] pygame.draw.rect function stretches across the screen instead of moving BubblesTheGiraffe 2 467 Jun-11-2019, 08:32 PM
Last Post: metulburr
  moving a sprite pfaber11 3 516 May-15-2019, 12:52 PM
Last Post: pfaber11
  [PyGame] Need Help With Sprite ghost0fkarma 2 912 Jan-09-2018, 02:14 PM
Last Post: ghost0fkarma

Forum Jump:


Users browsing this thread: 1 Guest(s)