def __init__(self,
                 image=None,
                 pos=None,
                 speed=None,
                 orbit_center=None,
                 stage=None,
                 center_drawing_color=None,
                 pos_drawing_color=None,
                 rect_drawing_color=None,
                 **kwargs):
        """Create a game object with ``image`` and ``center`` position.

        In contrast with ``Actor`` all parameters are optional in
        order to support client-side initialization by setting
        attributes.

        When an ``image`` is missing, we use a 1x1 pixel transparent
        image instead.

        If ``center_drawing_color``, ``pos_drawing_color``, or
        ``rect_drawing_color`` are given, then this class will
        draw a center point, a coordinate tuple, or
        a bounding rectangle respectively.
        """
        Actor.__init__(self, image, pos=pos, **kwargs)
        if speed is None:
            speed = self.DEFAULT_SPEED
        self.speed = speed
        self.orbit_center = orbit_center
        self.total_orbit_angle = 0
        self.stage = stage
        self.rect_drawing_color = rect_drawing_color
        self.center_drawing_color = center_drawing_color
        self.pos_drawing_color = pos_drawing_color
Ejemplo n.º 2
0
 def __init__(self, name, back_image, card_image):
     Actor.__init__(self, back_image, (0, 0))
     self.name = name
     self.back_image = back_image
     self.card_image = card_image
     # Status can be 'back' (turned over) 'front' (turned up) or 'hidden' (already used)
     self.status = 'back'
Ejemplo n.º 3
0
 def __init__(self, ship_type, grid, grid_pos, direction, hidden=False):
     Actor.__init__(self, ship_type, (10, 10))
     self.ship_type = ship_type
     self.grid = grid
     self.image = ship_type
     self.grid_pos = grid_pos
     self.topleft = self.grid.grid_pos_to_screen_pos((grid_pos))
     # Set the actor anchor position to centre of the first square
     self.anchor = (38 / 2, 38 / 2)
     self.direction = direction
     if (direction == 'vertical'):
         self.angle = -90
     self.hidden = hidden
     if (ship_type == "destroyer"):
         self.ship_size = 2
         self.hits = [False, False]
     elif (ship_type == "cruiser"):
         self.ship_size = 3
         self.hits = [False, False, False]
     elif (ship_type == "submarine"):
         self.ship_size = 3
         self.hits = [False, False, False]
     elif (ship_type == "battleship"):
         self.ship_size = 4
         self.hits = [False, False, False, False]
     elif (ship_type == "carrier"):
         self.ship_size = 5
         self.hits = [False, False, False, False, False]
Ejemplo n.º 4
0
 def __init__(self,
              image,
              pos,
              enemy_type,
              path_index=0,
              anchor=None,
              **kwargs):
     Actor.__init__(self, image, pos, anchor, **kwargs)
     self.path1 = [(1000, 325), (925, 325), (925, 475), (775, 475),
                   (775, 225), (675, 225), (675, 350), (600, 350),
                   (600, 275)]
     self.path2 = [(700, 575), (700, 525), (425, 525), (425, 375),
                   (450, 375), (450, 275), (400, 275), (400, 125),
                   (600, 125), (600, 275)]
     self.path3 = [(200, 75), (325, 75), (325, 525), (400, 525), (400, 375),
                   (450, 375), (450, 275), (400, 275), (400, 125),
                   (600, 125), (600, 275)]
     self.path4 = [(200, 75), (325, 75), (325, 525), (400, 525), (400, 375),
                   (450, 375), (450, 275), (400, 275), (400, 125), (600,
                                                                    125),
                   (600, 275), (600, 350), (675, 350), (675, 225),
                   (775, 225), (775, 475), (925, 475), (925, 325),
                   (1000, 325)]
     self.path_index = path_index
     self.type = enemy_type
     self.speed_list = [0.2, 0.5, 1, 0.2, 1]
     self.speed = self.speed_list[self.type - 1]
     self.health_list = [20, 50, 50, 100, 100]
     self.health = self.health_list[self.type - 1]
     self.appear_time = time.time()
     self.boss_born_time = 0
     self.frozen = False
     self.frozen_time = 0
Ejemplo n.º 5
0
 def __init__(self, x, y, obrot, obraz):
     Actor.__init__(self, obraz)
     self.pos = (x, y)
     self.x = x
     self.y = y
     self.obraz = obraz
     self.size = (10, 10)
     self.obrot = obrot
Ejemplo n.º 6
0
 def __init__(self, image, pos, tower_type, anchor=None, **kwargs):
     Actor.__init__(self, image, pos, anchor, **kwargs)
     self.type = tower_type
     self.range = 150
     self.in_range = False
     self.cost_list = [50, 100, 200]
     self.cost = self.cost_list[self.type - 1]
     self.shoots = []
     self.last_attack_time = time.time()
     self.booming = False
Ejemplo n.º 7
0
 def __init__(self, theme, theme_num, player_image_format, screen_width,
              screen_height):
     self.theme = theme
     self.theme_num = theme_num
     self.player_image_format = player_image_format
     self.screen_width = screen_width
     self.screen_height = screen_height
     # Call Actor constructor (center the Actor)
     Actor.__init__(self, self.getImage(),
                    (self.screen_width / 2, self.screen_height / 2))
Ejemplo n.º 8
0
 def __init__(self, name, back_image, card_image):
     Actor.__init__(self, back_image, (0, 0))
     self.name = name
     self.back_image = back_image
     self.card_image = card_image
     # Status can be 'back' (turned over) 'front' (turned up) or 'hidden' (already used)
     self.status = 'back'
     # Number is unique number based on position
     # count left to right, top to bottom
     # updated after dealt
     self.number = None
Ejemplo n.º 9
0
 def __init__(self, name, back_image, card_image):
     Actor.__init__(self, back_image, (0,0))
     self.name = name
     self.back_image = back_image
     self.card_image = card_image
Ejemplo n.º 10
0
 def __init__(self, hit, pos):
     Actor.__init__(self, hit)
     self.topleft = pos