def __init__(self, world, images_lf, images_rf): GameEntity.__init__(self, world, "hare", None) # self.dead_image = pygame.transform.flip(image, 0, 1) self.health = 25 self.max_speed = 0 self.current_frame = 0 self.frame_timer = FRAME_TIME self.images_lf = images_lf self.images_rf = images_rf self.left_facing = False self.human_chasing = None self.amount_ran = 0.0 exploring_state = HareStateExploring(self) fleeing_state = HareStateFleeing(self) self.brain.add_state(exploring_state) self.brain.add_state(fleeing_state) self.brain.set_state("exploring")
def __init__(self, world, playernumber): GameEntity.__init__(self, world, "human_red", None) fmt = "images/davy%i.png" if playernumber == 1 else "images/aslak%i.png" image_files = map(lambda i: fmt%(i+1), xrange(2)) self.images_lf = map(lambda f: loadImage(f), image_files) self.images_rf = map(lambda i: pygame.transform.flip(i, 1, 0), self.images_lf) self.current_frame = 0 self.frame_timer = FRAME_TIME self.left_facing = False self.carry_image = None self.max_speed = 180. self.player_number = playernumber self.hunger = 100.0 self.hunger_image_index = 0 self.thirst = 100.0 self.thirst_image_index = 0 self.heat = 100.0 self.heat_image_index = 0 self.age = 0.0 self.sounds = {"walk":pygame.mixer.Sound("audio/running_in_snow.wav"), "eat":pygame.mixer.Sound("audio/eat.wav"), } self.x_heading = 0 self.y_heading = 0 if(pygame.joystick.get_count() > self.world.joystick_in_use): self.setup_joystick() else: self.joycontrol = -1 self.init_keymap(self.player_number)
def __init__(self, world, images): GameEntity.__init__(self, world, "fire", None) self.images = images self.current_frame = randint(0,2) self.frame_timer = randint(0, 100)/100.0 self.life_time = 30.0 + randint(1, 15)
def __init__(self, world, images): GameEntity.__init__(self, world, "water", None) self.images = images self.current_frame = randint(0,1) self.frame_timer = randint(0, 100)/100.0
def __init__(self, world, image): GameEntity.__init__(self, world, "grass", image)
def __init__(self, world, image): GameEntity.__init__(self, world, "block", image)