Exemplo n.º 1
0
 def __init__(self, space, batch, pos, mineral_list):
     Action.__init__(self, space, batch, pos, "mining_animation/frame_0000.png", "mining")
     self.mineral_list = mineral_list
     self.timer = None
     self.current_frame = 0
     self.current_frame_duration = self.FRAME_DURATION
     self.frames = list()
     for img in sorted(glob.glob("img/mining_animation/frame_*")):
         self.frames.append(pyglet_util.load_image(img.split("img/")[1]))
Exemplo n.º 2
0
 def __init__(self, space, batch, pos, mineral_list):
     Action.__init__(self, space, batch, pos,
                     "mining_animation/frame_0000.png","mining")
     self.mineral_list = mineral_list
     self.timer = None
     self.current_frame = 0
     self.current_frame_duration = self.FRAME_DURATION
     self.frames = list()
     for img in sorted(glob.glob("img/mining_animation/frame_*")):
         self.frames.append(pyglet_util.load_image(img.split("img/")[1]))
Exemplo n.º 3
0
    def create_electric_charge_sprite(self, charge, batch):
        self.electric_charge_sprite = None
        if charge == 0:
            return
        elif charge > 0:
            charge_str = "+" + str(charge)
        else:
            charge_str = str(charge)

        e = pyglet_util.load_image("e" + charge_str + ".png")
        group = RenderingOrder.charge
        self.electric_charge_sprite = pyglet.sprite.Sprite(e, batch=batch, group=group)
        self.electric_charge_sprite.scale = self.scale
Exemplo n.º 4
0
 def __init__(self, symbol, charge, space, batch, molecule, pos):
     img = pyglet_util.load_image("atom-" + symbol.lower() + ".png")
     group = RenderingOrder.elements
     pyglet.sprite.Sprite.__init__(self, img, batch=batch, group=group, subpixel=True)
     self.cml = CachedCml.getMolecule(symbol)
     self.scale = self.cml.property["Radius"] * SCALE_FACTOR
     self.create_electric_charge_sprite(charge, batch)
     self.molecule = molecule
     self.symbol = symbol
     self.charge = charge
     self.space = space
     self.active = False
     self.init_chipmunk()
     self.move(pos)
Exemplo n.º 5
0
    def create_electric_charge_sprite(self, charge, batch):
        self.electric_charge_sprite = None
        if charge == 0:
            return
        elif charge > 0:
            charge_str = "+" + str(charge)
        else:
            charge_str = str(charge)

        e = pyglet_util.load_image("e" + charge_str + ".png")
        group = RenderingOrder.charge
        self.electric_charge_sprite = pyglet.sprite.Sprite(e,
                                                           batch=batch,
                                                           group=group)
        self.electric_charge_sprite.scale = self.scale
Exemplo n.º 6
0
 def __init__(self, symbol, charge, space, batch, molecule, pos):
     img = pyglet_util.load_image("atom-" + symbol.lower() + ".png")
     group = RenderingOrder.elements
     pyglet.sprite.Sprite.__init__(self,
                                   img,
                                   batch=batch,
                                   group=group,
                                   subpixel=True)
     self.cml = CachedCml.getMolecule(symbol)
     self.scale = self.cml.property["Radius"] * SCALE_FACTOR
     self.create_electric_charge_sprite(charge, batch)
     self.molecule = molecule
     self.symbol = symbol
     self.charge = charge
     self.space = space
     self.active = False
     self.init_chipmunk()
     self.move(pos)
Exemplo n.º 7
0
 def __init__(self, space, batch, pos, img_path, name):
     group = RenderingOrder.background
     img = pyglet_util.load_image(img_path)
     pyglet.sprite.Sprite.__init__(self, img, batch=batch, group=group)
     self.scale = Config.current.zoom
     Effect.__init__(self, space=space, name=name, pos=pos)
Exemplo n.º 8
0
 def __init__(self, space, batch, pos, img_path, name):
     group = RenderingOrder.background
     img = pyglet_util.load_image(img_path)
     pyglet.sprite.Sprite.__init__(self, img, batch=batch, group=group)
     self.scale = Config.current.zoom
     Effect.__init__(self, space = space, name = name, pos = pos)