a Rect object with color?
To: pygame-users@seul.org
Date: Sunday, November 8, 2009, 1:39 AM
Lemme borrow Russell's method to show what I think is your missing piece: some
way of getting a boom tower's rectangle onto the game's playfield (the main
PyGame surface). Run it, and left-click the mouse
This is kind of embarrasing but I forgot how to fill a rect object with a
certain color.
I don't think rect objects were meant for that. You could go:
rect = a rect object
pygame.draw.rect(surface,color,rect,0)
Ian
Or you can create a surface the size of the rect and use the Surface's
fill() method.
E.g.
position = x,y = 0,0
size = w,h = 32,32
colour = 0,255,0
rect = Rect(position, size)
image = Surface(size)
image.fill(colour)
2009/11/7 Ian Mallett geometr...@gmail.com
I don't think rect objects were
Yes, rects are only objects that delimit a rectangular area. Areas that can
be drawn onto are Surfaces, and you could draw rectangles to those surfaces
the ways Ian and RusselI mentioned.
On Sat, Nov 7, 2009 at 16:34, Yanom Mobis ya...@rocketmail.com wrote:
This is kind of embarrasing but I
Hi
even simpler:
image.fill(color, rect)
~DR0ID
Russell Cumins schrieb:
Or you can create a surface the size of the rect and use the Surface's
fill() method.
E.g.
position = x,y = 0,0
size = w,h = 32,32
colour = 0,255,0
rect = Rect(position, size)
image = Surface(size)
image.fill(colour)
On Sat, Nov 7, 2009 at 10:34 AM, Yanom Mobis ya...@rocketmail.com wrote:
This is kind of embarrasing but I forgot how to fill a rect object with a
certain color.
Here's everything so you can see the full context.
import pygame
from pygame.locals import *
pygame.init()
BoomTower.shoot needs to fill that BoomTower
object's
rangerect with a certain color
does that make any sense? Not to be rude but am i confusing you?
--- On Sat, 11/7/09, Ian Mallett geometr...@gmail.com wrote:
From: Ian Mallett geometr...@gmail.com
Subject: Re: [pygame] Fill a Rect object with color
that make any sense? Not to be rude but am i confusing you?
--- On *Sat, 11/7/09, Ian Mallett geometr...@gmail.com* wrote:
From: Ian Mallett geometr...@gmail.com
Subject: Re: [pygame] Fill a Rect object with color?
To: pygame-users@seul.org
Date: Saturday, November 7, 2009, 12:45 PM
I
Lemme borrow Russell's method to show what I think is your missing
piece: some way of getting a boom tower's rectangle onto the game's
playfield (the main PyGame surface). Run it, and left-click the mouse to
change the state of the boom tower.
import pygame
from pygame.locals import *
class
10 matches
Mail list logo