Ejemplo n.º 1
0
 def __init__(self, image, x, y, game):
     self.name = "Kangaroo"
     
     image = image_util.load_image("kangaroo.png")
     
     self.init_image = image
     self.init_x = x
     self.init_y = y
     
     attack_image = image_util.load_image("taz_attack.png")
     unselected_images = image_util.load_sliced_sprites(32, 32, "kangaroo_unselected.png")
     rect = image.get_rect()
     rect.left = 5
     rect.top = 5
     rect.width = rect.width-10
     rect.height = rect.height-10
     speed = 3
     
     attack_length = 250
     attack_delay = 200
     
     Player.__init__(self, game, x, y, image, attack_image, unselected_images, rect, speed, attack_length, attack_delay)
 
     self.attack_sprite = Sprite()
     self.attack_sprite.rect = image.get_rect()
     
     self.canDriveCar = True
 
     # jump
     self.jump_images = image_util.load_sliced_sprites(32, 32, "kangaroo_jump.png")
     self.jump_init_time = 50
     self.jump_time = 500
     self.is_jumping = False
     self.last_jump = -self.jump_time
Ejemplo n.º 2
0
 def __init__(self, image, x, y, game):
     self.name = "Tasmanian Devil"
     
     self.init_image = image_util.load_image("tasmanian.png")
     self.init_x = x
     self.init_y = y
     
     image = image_util.load_image("tasmanian.png")
     attack_image = image_util.load_image("tasmanian_attack.png")
     
     unselected_images = image_util.load_sliced_sprites(32, 32, "tasmanian_unselected.png")
     
     rect = image.get_rect()
     rect.left = 5
     rect.top = 5
     rect.width = rect.width-10
     rect.height = rect.height-10
     speed = 3
     
     attack_length = 250
     attack_delay = 200
     
     Player.__init__(self, game, x, y, image, attack_image, unselected_images, rect, speed, attack_length, attack_delay)
     
     self.canDriveCar = False
Ejemplo n.º 3
0
    def __init__(self, image, x, y, game):
        self.name = "Brown Snake"

        self.init_image = image_util.load_image("snake.png")
        self.init_x = x
        self.init_y = y

        image = image_util.load_image("snake.png")
        attack_image = image_util.load_image("snake_attack.png")

        unselected_images = image_util.load_sliced_sprites(
            32, 32, "snake_unselected.png")

        rect = image.get_rect()
        rect.left = 5
        rect.top = 5
        rect.width = rect.width - 10
        rect.height = rect.height - 10
        speed = 3

        attack_length = 250
        attack_delay = 200

        Player.__init__(self, game, x, y, image, attack_image,
                        unselected_images, rect, speed, attack_length,
                        attack_delay)

        self.canDriveCar = False
Ejemplo n.º 4
0
 def __init__(self, image, x, y, game):
     self.name = "Dingo"
     
     self.init_image = image_util.load_image("dingo.png")
     self.init_x = x
     self.init_y = y
     
     image = image_util.load_image("dingo.png")
     attack_image = image_util.load_image("dingo_attack.png")
     
     unselected_images = image_util.load_sliced_sprites(32, 32, "dingo_unselected.png")
     
     rect = image.get_rect()
     rect.left = 5
     rect.top = 5
     rect.width = rect.width-10
     rect.height = rect.height-10
     speed = 3
     
     attack_length = 250
     attack_delay = 200
     
     Player.__init__(self, game, x, y, image, attack_image, unselected_images, rect, speed, attack_length, attack_delay)
 
     self.left_offset = 5
     self.top_offset = 5
     self.rect.width = 32 - self.left_offset * 2
     self.rect.height = self.rect.width
 
     self.attack_sprite = Sprite()
     self.attack_sprite.rect = image.get_rect()
     #self.attack_sprite.rect.width += 10
     #self.attack_sprite.rect.height += 10
     
     self.canDriveCar = False
Ejemplo n.º 5
0
 def __init__(self, image, x, y, game):
     self.name = "Koala"
     
     self.init_image = image
     self.init_x = x
     self.init_y = y
     
     attack_image = image_util.load_image("koala_attack.png")
     unselected_images = image_util.load_sliced_sprites(32, 32, "koala_unselected.png")
     
     rect = image.get_rect()
     rect.left = 5
     rect.top = 5
     rect.width = rect.width-10
     rect.height = rect.height-10
     speed = 3
     
     attack_length = 250
     attack_delay = 200
     
     Player.__init__(self, game, x, y, image, attack_image, unselected_images, rect, speed, attack_length, attack_delay)
 
     self.normal_rect = self.rect
     self.normal_left_offset = self.left_offset
     self.normal_top_offset = self.top_offset
     self.climbing_rect = pygame.Rect(15,15,rect.width - 30, rect.height - 30)
     self.climbing_left_offset = 15
     self.climbing_top_offset = 15
 
     self.attack_sprite = Sprite()
     self.attack_sprite.rect = image.get_rect()
     
     self.canDriveCar = False
     self.isInTree = False
Ejemplo n.º 6
0
 def ranOver(self, source):
     self.kill()
     if "Koala" not in animals_freed:
         self.game.free_animal("Koala")
         cutscene = Cutscene(self.game, "freed_koalas", \
                              [image_util.load_image(os.path.join("cutscenes","koala_intro.png"))], \
                              image_util.load_sliced_sprites(210, 80, os.path.join("cutscenes","press_enter.png")));
         cutscene.fire(self.game.player)
Ejemplo n.º 7
0
    def __init__(self, image, x, y, game):
        super(PoliceCar, self).__init__(image, x, y, game)
        self.driving = True
        self.accel_change = 0.03
        self.drag = 0.2

        self.images = image_util.load_sliced_sprites(32, 64, "police_car.png")
        self.current_image = self.images[0]
Ejemplo n.º 8
0
 def ranOver(self, source):
     self.kill()
     if "Koala" not in animals_freed:
         self.game.free_animal("Koala")
         cutscene = Cutscene(self.game, "freed_koalas", \
                              [image_util.load_image(os.path.join("cutscenes","koala_intro.png"))], \
                              image_util.load_sliced_sprites(210, 80, os.path.join("cutscenes","press_enter.png")))
         cutscene.fire(self.game.player)
Ejemplo n.º 9
0
 def __init__(self, image, x, y, game):
     super(PoliceCar, self).__init__(image, x, y, game)
     self.driving = True
     self.accel_change = 0.03
     self.drag = 0.2
     
     self.images = image_util.load_sliced_sprites(32, 64, "police_car.png")
     self.current_image = self.images[0]
Ejemplo n.º 10
0
 def free_animal(self, animal_name):
     animals_freed[animal_name] = image_util.load_image(animal_info.info[animal_name][3])
     self.hud.draw()
     if len(animals_freed) is 5 and self.animalsFreed is False:
         cutscene = Cutscene(self, "escape the zoo", \
                              [image_util.load_image(os.path.join("cutscenes","escape_the_zoo.png"))], \
                              image_util.load_sliced_sprites(210, 80, os.path.join("cutscenes","press_enter.png")));
         cutscene.fire(self.player)
         self.animalsFreed = True
Ejemplo n.º 11
0
    def __init__(self, name, screen, game):
        # Make the full pathname of the map
        self.fullname = os.path.join('map', 'maps', name)

        self.tiles = []

        self.splat_idx = 0
        self.max_splats = 20
        self.splats = []

        self.game_objects = pygame.sprite.Group()
        self.unjumpable_objects = pygame.sprite.Group()
        self.unwalkable_tiles = pygame.sprite.Group()
        self.unswimmable_and_unwalkable_tiles = pygame.sprite.Group()
        self.unjumpable_tiles = pygame.sprite.Group()
        self.high_level = pygame.sprite.Group()
        self.not_player = pygame.sprite.Group()
        self.loaded_cutscenes = dict()

        self.screen = screen
        self.game = game

        self.events = dict()

        self.visitor_spawn_rate = 1000
        self.num_visitors = 0
        self.max_visitors = 50

        self.num_zookeepers = 0
        self.max_zookeepers = 5

        self.num_animals = 0
        self.max_animals = 20

        self.first_visible_x = 0
        self.last_visible_x = 0
        self.first_visible_y = 0
        self.last_visible_y = 0

        self.width = 0
        self.height = 0

        self.start_cutscenes = []
        self.played_cutscenes = dict()

        self.shouldCreateVisitors = False
        self.shouldCreateZookeepers = False
        self.shouldCreateAnimals = False

        self.press_enter = image_util.load_sliced_sprites(
            210, 80, os.path.join("cutscenes", "press_enter.png"))
Ejemplo n.º 12
0
    def __init__(self, image, x, y, game):
        self.name = "Kangaroo"

        image = image_util.load_image("kangaroo.png")

        self.init_image = image
        self.init_x = x
        self.init_y = y

        attack_image = image_util.load_image("taz_attack.png")
        unselected_images = image_util.load_sliced_sprites(
            32, 32, "kangaroo_unselected.png")
        rect = image.get_rect()
        rect.left = 5
        rect.top = 5
        rect.width = rect.width - 10
        rect.height = rect.height - 10
        speed = 3

        attack_length = 250
        attack_delay = 200

        Player.__init__(self, game, x, y, image, attack_image,
                        unselected_images, rect, speed, attack_length,
                        attack_delay)

        self.attack_sprite = Sprite()
        self.attack_sprite.rect = image.get_rect()

        self.canDriveCar = True

        # jump
        self.jump_images = image_util.load_sliced_sprites(
            32, 32, "kangaroo_jump.png")
        self.jump_init_time = 50
        self.jump_time = 500
        self.is_jumping = False
        self.last_jump = -self.jump_time
Ejemplo n.º 13
0
    def __init__(self, name,screen,game):
        # Make the full pathname of the map
        self.fullname = os.path.join('map', 'maps', name)
        
        self.tiles = []
        
        self.splat_idx = 0
        self.max_splats = 20
        self.splats = []
          
        self.game_objects = pygame.sprite.Group()
        self.unjumpable_objects = pygame.sprite.Group()
        self.unwalkable_tiles = pygame.sprite.Group()
        self.unswimmable_and_unwalkable_tiles = pygame.sprite.Group()
        self.unjumpable_tiles = pygame.sprite.Group()
        self.high_level = pygame.sprite.Group()
        self.not_player = pygame.sprite.Group()
        self.loaded_cutscenes = dict()
        
        self.screen=screen
        self.game=game
        
        self.events = dict()
        
        self.visitor_spawn_rate = 1000
        self.num_visitors = 0
        self.max_visitors = 50
        
        self.num_zookeepers = 0
        self.max_zookeepers = 5
        
        self.num_animals = 0
        self.max_animals = 20
        
        self.first_visible_x = 0
        self.last_visible_x = 0
        self.first_visible_y = 0
        self.last_visible_y = 0
        
        self.width = 0
        self.height = 0
        
        self.start_cutscenes = []
        self.played_cutscenes = dict()

        self.shouldCreateVisitors = False
        self.shouldCreateZookeepers = False
        self.shouldCreateAnimals = False
        
        self.press_enter = image_util.load_sliced_sprites(210, 80, os.path.join("cutscenes","press_enter.png"))
Ejemplo n.º 14
0
 def __init__(self, image, x, y, game):
     self.init_x = x
     self.init_y = y
     self.init_image = None
     
     self.images = image_util.load_sliced_sprites(32, 64, "red_car.png")
     
     super(Car, self).__init__(self.images[0], (x*tile_size,y*tile_size), game)
     
     self.current_image = self.images[0]
     
     self.speed = 1
     
     self.max_speed = 6
     
     self.forward_speed = 0
     self.side_speed = 0
     
     self.max_forward_acceleration = .5
     self.max_side_acceleration = .5
     
     self.forward_acceleration = 0
     self.side_acceleration = 0
     
     self.direction = UP
     
     self.start_time = pygame.time.get_ticks()
     
     self.driver = None
     
     self.driving = False
     
     self.health = 30
     self.damage = 0
     self.damage_index = 0
     self.first_damage_point = 10
     self.second_damage_point = 20
     self.third_damage_point = 25
     self.drag = 0.2
Ejemplo n.º 15
0
    def __init__(self, image, x, y, game):
        self.name = "Koala"

        self.init_image = image
        self.init_x = x
        self.init_y = y

        attack_image = image_util.load_image("koala_attack.png")
        unselected_images = image_util.load_sliced_sprites(
            32, 32, "koala_unselected.png")

        rect = image.get_rect()
        rect.left = 5
        rect.top = 5
        rect.width = rect.width - 10
        rect.height = rect.height - 10
        speed = 3

        attack_length = 250
        attack_delay = 200

        Player.__init__(self, game, x, y, image, attack_image,
                        unselected_images, rect, speed, attack_length,
                        attack_delay)

        self.normal_rect = self.rect
        self.normal_left_offset = self.left_offset
        self.normal_top_offset = self.top_offset
        self.climbing_rect = pygame.Rect(15, 15, rect.width - 30,
                                         rect.height - 30)
        self.climbing_left_offset = 15
        self.climbing_top_offset = 15

        self.attack_sprite = Sprite()
        self.attack_sprite.rect = image.get_rect()

        self.canDriveCar = False
        self.isInTree = False
Ejemplo n.º 16
0
 def __init__(self, image, x, y, game):
     super(DingoDoor, self).__init__(image, (x*TILE_SIZE, y*TILE_SIZE), game)
     self.cutscene = Cutscene(self.game, "freed dingos", \
                              [image_util.load_image(os.path.join("cutscenes","dingo_free.png"))], \
                              image_util.load_sliced_sprites(210, 80, os.path.join("cutscenes","press_enter.png")));
     self.game.current_map.game_objects.add(self)