Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 [PyGame] assigning rect to sprite
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))

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))

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  [PyGame] How to create a sprite in a different module I_like_pepperjack 1 204 Aug-15-2019, 10:23 AM
Last Post: metulburr
  Need help making a sprite GalaxyCoyote 4 227 Aug-11-2019, 09:12 PM
Last Post: metulburr
  creating sprite mask pfaber11 5 443 Jun-12-2019, 09:39 PM
Last Post: pfaber11
  [PyGame] pygame.draw.rect function stretches across the screen instead of moving BubblesTheGiraffe 2 353 Jun-11-2019, 08:32 PM
Last Post: metulburr
  [PyGame] Making Player Sprite Ricochet of walls michael1789 4 339 Jun-03-2019, 10:45 PM
Last Post: Windspar
  moving a sprite pfaber11 3 430 May-15-2019, 12:52 PM
Last Post: pfaber11
  Pygame Class Sprite Placement Confusion TheHumbleIdiot 2 684 Sep-11-2018, 02:19 PM
Last Post: TheHumbleIdiot
  [PyGame] How to stop the sprite's movement when it touches the edges of the screen? mrmn 5 2,041 May-13-2018, 06:33 PM
Last Post: mrmn
  [PyGame] Need Help With Sprite ghost0fkarma 2 852 Jan-09-2018, 02:14 PM
Last Post: ghost0fkarma
  [PyGame] Problem assigning positions on CC plane. Gengar 2 2,417 Sep-19-2016, 03:38 AM
Last Post: Gengar

Forum Jump:

Users browsing this thread: 1 Guest(s)