Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Rect is not transparent


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Zed McJack   Members   -  Reputation: 349

Like
0Likes
Like

Posted 04 November 2012 - 03:56 PM

I changed the backgroud for MyPong from black to red just to show you that Rectangle of the ball is not transparent.
I looked at web, there is transparency, but it affects all picture not just corners. For that I suppose I will need Sprite class from Pygame, but I wanted to check if there is any solution for this, before moving to sprites.

Z
Ups I didnt post any code so:
[source lang="python"]def draw_circle(radius, color): size = radius*2 pict = pygame.Surface((size, size)) pygame.draw.circle(pict, color, (radius, radius), radius) return pict, pict.get_rect()ball, ball_rect = draw_circle(10, [0, 100, 50])[/source]

Attached Thumbnails

  • Pong-ball.jpg

Edited by Zed McJack, 06 November 2012 - 05:35 AM.


Sponsor:

#2 Zed McJack   Members   -  Reputation: 349

Like
0Likes
Like

Posted 06 November 2012 - 05:39 AM

Ok, I found solution.
Its not Rect, the Surface is the solution as Rect is drawn onto a Surface and you can set colorkey for transparency so I added.
ball.pict.set_colorkey((0,0,0))


and it worked

Z.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS