I'm not 100% sure what you are wanting to change the colour so forgive me if
I'm going off on a tangent here. From what you have said thus far I am
assuming you want to change the colour of the BoomTower object when it if
firing.
What I would do is this...
class BoomTower:
def __init__(self,position,size,colour,fireColour):
self.colour = colour
self.fireColour = fireColour
self.rect = Rect(position,size)
self.image = Surface(size)
self.image.fill(colour) ## Set the colour to the default
def shoot(self,...):
...## Your other code here
self.image.fill(self.fireColour)
You probably need to add some more code elsewhere to change the colour back
for when the BoomTower object is not firing.
2009/11/8 Yanom Mobis <[email protected]>
> i tried that the problem is that class BoomTower has rect object rangerect,
> and in
>
> class BoomTower( yattayatta )
> def __init__(yatta, yatta):
> (rangerect defined)
> def shoot( yatta, yatta):
> (this code here needs to do the filling)
>
> so ya the last line of function 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 <[email protected]>* wrote:
>
>
> From: Ian Mallett <[email protected]>
> Subject: Re: [pygame] Fill a Rect object with color?
> To: [email protected]
> Date: Saturday, November 7, 2009, 12:45 PM
>
>
> 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
>
>
>