Source

pygamegsoc12 / alchemymadness / tubes.py


import layout
import resources
from sprite import MaskedSprite, Node

class Tubes(Node):
    def __init__(self, *groups):
        super(Tubes, self).__init__()
        for i, r in enumerate(layout.Main.tube_rects):
            self.add(Tube(i, r, *groups))

    def set_colors(self, colors):
        for t in self.children:
            t.mix_color(colors[t.id], 1.)

class Tube(Node, MaskedSprite):
    def __init__(self, tid, rect, *groups):
        super(Tube, self).__init__((255,255,255), *groups)
        self.id = tid
        self.rect = rect
        self.t_image = resources.background_mask.subsurface(self.rect)
        self.dirty = 1

    def update(self, time):
        super(Tube, self).update(time)
        print 't update'