Exemplo n.º 1
0
    def __init__(self, canvas, x, y, *, gamemap, effect):
        barimage = Registry.get_texture("qbubbles:gui",
                                        "qbubbles:effect_bar",
                                        gamemap=gamemap)
        effectimage = Registry.get_texture("qbubbles:effect",
                                           effect.get_uname(),
                                           gamemap=gamemap)

        self.cBarimage = CImage(canvas, x, y, image=barimage, anchor="nw")
        self.cEffectimage = CImage(canvas,
                                   x + 2,
                                   y + 2,
                                   image=effectimage,
                                   anchor="nw")
        self._effect = effect
Exemplo n.º 2
0
 def create(self, x, y):
     image = Registry.get_texture("sprite", "player", rotation=0)
     self.id = self._c_create_image(x, y, image, anchor="center")
     # self.id = Registry.get_scene("Game").canvas.create_image(x, y, image=Registry.get_texture("sprite", "player",
     #                                                                                           rotation=0))
     self.baseSpeed = 80
     self.speed = self.baseSpeed
Exemplo n.º 3
0
    def _update_rot_tex(self):
        """
        Updates the rotation texture

        :return:
        """
        image = Registry.get_texture("sprite", "player", rotation=int(self.rotation - (self.rotation % 1)))
        c = Registry.get_scene("Game").canvas
        c.itemconfig(self.id, image=image)
Exemplo n.º 4
0
 def create(self, x, y, radius=5, speed=5, health=5):
     if self.baseClass is None:
         raise UnlocalizedNameError(f"BubbleObject is used for Sprite information, use the base_class argument with "
                                    f"a Bubble-instance instead of NoneType to fix this problem")
     if self.id is not None:
         raise OverflowError(f"BubbleObject is already created")
     canvas: Canvas = Registry.get_scene("Game").canvas
     self.defenceMultiplier = self.baseClass.defenceMultiplier
     self.attackMultiplier = self.baseClass.attackMultiplier
     self.baseSpeed = speed
     self.health = health
     self.radius = radius / 2
     self.id = canvas.create_image(
         x, y, image=Registry.get_texture("qbubbles:bubble", self.baseClass.get_uname(), radius=radius))
     self._objectData["radius"] = radius
     self._objectData["speed"] = speed
     self._objectData["health"] = health
     self._objectData["Position"] = (x, y)
     UpdateEvent.bind(self.on_update)
     CleanUpEvent.bind(self.on_cleanup)
     CollisionEvent.bind(self.on_collision)