Ejemplo n.º 1
0
    def __init__(self, screen: pygame.Surface, args: dict, parent: 'Room'):
        ObjectBase.__init__(self, screen, args, parent)

        self.image = get_image("enemy")
        self.drawable = self.image

        self.w, self.h = self.image.get_size()

        self.angle = -90

        self.drawable = self.rotate_object(self.image, self.angle - 90)
        self.curAngle = self.angle - 90
        self.velocity = 100

        self.scoreboard = self.get_all_type("Text")[0]  # type: Text

        self.screen_c_w, self.screen_c_h = utils.get_surface_center(
            self.screen)
        self.tPlayer = None

        self.PlayerList = [None, None]
        self.realAngle = 0
        for obj in self.siblings:
            if (obj.object_type == "Player"):
                print(obj.get_num())
                if (obj.get_num() == 1):
                    self.PlayerList[0] = obj
                    self.tPlayer = obj

                else:
                    self.PlayerList[1] = obj
        self.tPlayer = self.PlayerList[random.randint(0, 1)]
Ejemplo n.º 2
0
 def calculate_center(self, width:int=None, height:int=None):
     """
     Calculates the x, y position to place the specified object in the center of the screen 
     :param width: The width of the object to center (ommit and "None" will be returned for the "x" position)
     :param height: The height of the object to center (ommit and "None" will be returned for the "y" position)
     :return: the x, y position to place the object to center it
     """
     c = get_surface_center(self.screen)
     w, h = None, None
     if width is not None:
         w = c[0] - (width / 2)
     if height is not None:
         h = c[1] - (height / 2)
     return w, h
Ejemplo n.º 3
0
    def __init__(self, screen:pygame.Surface, args: dict, parent:'Room'):
        ObjectBase.__init__(self, screen, args, parent)

        self.image = get_image("enemy")
        self.drawable = self.image

        self.w, self.h = self.image.get_size()

        self.angle = 0

        self.drawable = self.rotate_object(self.image, self.angle)
        self.velocity = 100 + GlobalVariable.wave*5

        self.scoreboard = self.get_all_type("Text")[0]     # type: Text

        self.screen_c_w, self.screen_c_h = utils.get_surface_center(self.screen)
Ejemplo n.º 4
0
    def __init__(self, screen: pygame.Surface, args: dict, parent: 'Room'):
        ObjectBase.__init__(self, screen, args, parent)

        self.image = get_image("doublestackpumpkin")
        self.drawable = self.image

        self.w, self.h = self.image.get_size()

        self.angle = 0

        self.drawable = self.rotate_object(self.image, self.angle - 90)
        self.velocity = 100

        self.scoreboard = self.get_all_type("Text")[0]  # type: Text

        self.screen_c_w, self.screen_c_h = utils.get_surface_center(
            self.screen)
        self.bulletCounter = 0