-2

I am using

player = pygame.draw.rect(screen, player_color, player_pos, 30, 1, 1, 1, 1, 1)

with

  • screen as my surface
  • player_color as my color
  • player_pos as my rectvalue
  • 30 as my width
  • 1 as my border_radius
  • 1 as my border_top_left_radius
  • 1 as my border_top_right_radius
  • 1 as my border_bottom_left_radius
  • 1 as my border_bottom_right_radius

but whenever it runs it crashes and says "TypeError: rect argument is invalid" and yes I have all variables defined and spelled right, I am using VS Code if that changes anything im not sure i am pretty new to coding.

I was expecting it to make a rectangle with the cords in the player_pos.

2
  • how do you create player_pos ? It has to be pygame.Rect() Commented Mar 1 at 20:01
  • always put full error message because there are other useful information. Commented Mar 1 at 20:02

1 Answer 1

-1

According to the documentation, the third argument should be a Rect. player_pos sounds like this might be a 2D point and not a rectange.

(Unrelated to the issue: setting the border radius for all four corners to the same value when you already set border_radius is unneccessary.)

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.