Captainvon123
Captainvon123

Reputation: 27

How to show a pictures rectangle after calling get_rect()

I would greatly appreciate it if anyone could tell me how to show the rectangle of an image after calling get_rect() on that image

I have done this:

self.sword_rect = sword_swing.get_rect()
self.sword_rect.center = (self.player_x, self.player_y)

and want to see where it is on the screen

Is this possible? If so, how?

Thanks in advance

Upvotes: 1

Views: 55

Answers (1)

Rabbid76
Rabbid76

Reputation: 210878

I recommend to use pygame.draw.rect(). For instance:

color = (255, 0, 0)
pygame.draw.rect(screen, color, self.sword_rect, 1) 

(screen is the surface which is associated to the display)

Upvotes: 1

Related Questions