def init_parallax_ressources(width, height): if parallax_ressources == {}: parallax_ressources['back'] = pygame.transform.scale( routines.load_png('world/trees/far-background.png')[0], (width, height)) parallax_ressources['front'] = pygame.transform.scale( routines.load_png('world/trees/near-background.png')[0], (width, height))
def init_fairy_ressources(): if fairy_ressource == {}: fairy_ressource['full'] = routines.load_png( 'pnj/fairy/botteled_fairy.png') fairy_ressource['empty'] = routines.load_png( 'pnj/fairy/broken_glass.png') fairy_ressource['broken_sound'] = pygame.mixer.Sound( 'data/sound/glass.wav') fairy_ressource['scream'] = pygame.mixer.Sound('data/sound/scream.wav')
def init_spikes_ressources(): if spikes_ressources == {}: spikes_ressources['up'] = routines.load_png( 'world/spikes/Spike_up.png') spikes_ressources['right'] = routines.load_png( 'world/spikes/Spike_right.png') spikes_ressources['down'] = routines.load_png( 'world/spikes/Spike_down.png') spikes_ressources['left'] = routines.load_png( 'world/spikes/Spike_left.png')
def __init__(self): """ Constructor function """ Character.__init__(self) #Load images and rectangles self.jump_l_image, self.jump_l_image_rect = routines.load_png('hero_3/jump_l.png') self.jump_r_image, self.jump_r_image_rect = routines.load_png('hero_3/jump_r.png') self.idle_l_image, self.idle_l_image_rect = routines.load_png('hero_3/idle_l.png') self.idle_r_image, self.idle_r_image_rect = routines.load_png('hero_3/idle_r.png') self.move_1_r_image, self.move_1_r_image_rect = routines.load_png('hero_3/move_1_r.png') self.move_1_l_image, self.move_1_l_image_rect = routines.load_png('hero_3/move_1_l.png') self.move_2_r_image, self.move_2_r_image_rect = routines.load_png('hero_3/move_2_r.png') self.move_2_l_image, self.move_2_l_image_rect = routines.load_png('hero_3/move_2_l.png') self.dead_image, self.dead_image_rect = routines.load_png('hero_3/death.png') #load sounds self.sounds={} self.sounds['jump']=pygame.mixer.Sound('data/sound/jump.wav') self.image = self.idle_l_image self.rect = self.idle_l_image_rect # Set a referance to the image rect. #Setup status self.status = 'idle_r' #idle,move,jump, self.location = 'ground' #ground,air,block Character.set_options(self, 13, 0, 1)
def __init__(self): """ Constructor function """ Character.__init__(self) self.jump_l_image, self.jump_l_image_rect = routines.load_png( 'hero_2/jump_l.png') self.jump_r_image, self.jump_r_image_rect = routines.load_png( 'hero_2/jump_r.png') self.idle_l_image, self.idle_l_image_rect = routines.load_png( 'hero_2/idle_l.png') self.idle_r_image, self.idle_r_image_rect = routines.load_png( 'hero_2/idle_r.png') self.move_1_r_image, self.move_1_r_image_rect = routines.load_png( 'hero_2/move_1_r.png') self.move_1_l_image, self.move_1_l_image_rect = routines.load_png( 'hero_2/move_1_l.png') self.move_2_r_image, self.move_2_r_image_rect = routines.load_png( 'hero_2/move_2_r.png') self.move_2_l_image, self.move_2_l_image_rect = routines.load_png( 'hero_2/move_2_l.png') self.dead_image, self.dead_image_rect = routines.load_png( 'hero_2/death.png') #load sounds self.sounds = {} self.sounds['jump'] = pygame.mixer.Sound('data/sound/jump.wav') self.image = self.idle_l_image self.rect = self.idle_l_image_rect # Set a referance to the image rect. #Setup status self.status = 'idle_r' #idle,move,jump, self.location = 'ground' #ground,air,block Character.set_options(self, 10, 2, 1.2)
def init_dragon_ressources(): if dragon_ressources == {}: dragon_ressources['body'] = routines.load_png( 'pnj/boss/dragon/body.png') dragon_ressources['fireball'] = routines.load_png( 'pnj/boss/dragon/fireball.png') dragon_ressources['head_down'] = routines.load_png( 'pnj/boss/dragon/head_down.png') dragon_ressources['head_up'] = routines.load_png( 'pnj/boss/dragon/head_up.png') dragon_ressources['cave'] = routines.load_png( 'pnj/boss/dragon/cave_entrance.png')
def __init__ (self, width, height): super(Platform, self).__init__() self.image = pygame.Surface([width, height]) magma_image = routines.load_png('world/lava/magma.png') magma_texture = pygame.transform.scale(magma_image[0], (width, height)) self.image.blit(magma_texture, (0, 0)) self.rect = self.image.get_rect()
def __init__(self, width, height): super(Platform, self).__init__() self.image = pygame.Surface([width, height]) magma_image = routines.load_png('world/lava/magma.png') magma_texture = pygame.transform.scale(magma_image[0], (width, height)) self.image.blit(magma_texture, (0, 0)) self.rect = self.image.get_rect()
def __init__(self, screen, unlocked_chars): #Init the menu #Draw with position = 1 self.screen = screen bob = routines.load_png('hero_3/idle_l.png') hulk = routines.load_png('hero_1/idle_l.png') little_fat = routines.load_png('hero_2/idle_l.png') #bob2 = routines.load_png('hero/idle_l.png') #self.characters = [bob,hulk] if unlocked_chars == 0: self.characters = [bob] elif unlocked_chars == 1: self.characters = [bob, hulk] else: self.characters = [bob, hulk, little_fat] self.draw(0)
def __init__(self): #Load images and rectangles self.lives_0_image, self.lives_0_image_rect = routines.load_png('heart/0.png') self.lives_1_image, self.lives_1_image_rect = routines.load_png('heart/1.png') self.lives_2_image, self.lives_2_image_rect = routines.load_png('heart/2.png') self.lives_3_image, self.lives_3_image_rect = routines.load_png('heart/3.png') self.lives_4_image, self.lives_4_image_rect = routines.load_png('heart/4.png') self.lives_5_image, self.lives_5_image_rect = routines.load_png('heart/5.png') self.lives_6_image, self.lives_6_image_rect = routines.load_png('heart/6.png') self.lives_arr = [ self.lives_0_image, self.lives_1_image, self.lives_2_image, self.lives_3_image, self.lives_4_image, self.lives_5_image, self.lives_6_image ] self.image = self.lives_6_image #lives are full self.rect = self.lives_6_image_rect
def init_spikes_ressources(): if spikes_ressources == {}: spikes_ressources['up'] = routines.load_png('world/spikes/Spike_up.png') spikes_ressources['right'] = routines.load_png('world/spikes/Spike_right.png') spikes_ressources['down'] = routines.load_png('world/spikes/Spike_down.png') spikes_ressources['left'] = routines.load_png('world/spikes/Spike_left.png')
def init_tree_ressources(): if tree_ressources == {}: tree_ressources['tree1'] = routines.load_png('world/trees/tree1.png')
def init_platform_ressources(): if platform_ressources == {}: platform_ressources['scratch'] = routines.load_png( 'world/platforms/scratch.png') platform_ressources['grass'] = routines.load_png( 'world/platforms/grass.png')
def init_blob_ressources(): if blob_ressources == {}: blob_ressources['left_blob1'] = routines.load_png( 'pnj/enemy/blob/left_blob1.png') blob_ressources['left_blob2'] = routines.load_png( 'pnj/enemy/blob/left_blob2.png') blob_ressources['left_blob3'] = routines.load_png( 'pnj/enemy/blob/left_blob3.png') blob_ressources['left_blob4'] = routines.load_png( 'pnj/enemy/blob/left_blob4.png') blob_ressources['left_blob5'] = routines.load_png( 'pnj/enemy/blob/left_blob5.png') blob_ressources['left_blob6'] = routines.load_png( 'pnj/enemy/blob/left_blob6.png') blob_ressources['right_blob1'] = routines.load_png( 'pnj/enemy/blob/right_blob1.png') blob_ressources['right_blob2'] = routines.load_png( 'pnj/enemy/blob/right_blob2.png') blob_ressources['right_blob3'] = routines.load_png( 'pnj/enemy/blob/right_blob3.png') blob_ressources['right_blob4'] = routines.load_png( 'pnj/enemy/blob/right_blob4.png') blob_ressources['right_blob5'] = routines.load_png( 'pnj/enemy/blob/right_blob5.png') blob_ressources['right_blob6'] = routines.load_png( 'pnj/enemy/blob/right_blob6.png') blob_ressources['dead'] = routines.load_png('pnj/enemy/blob/dead.png') blob_ressources['dead_sound'] = pygame.mixer.Sound( 'data/sound/blobdie.wav')
def init_platform_ressources(): if platform_ressources == {}: platform_ressources['scratch'] = routines.load_png('world/platforms/scratch.png') platform_ressources['grass'] = routines.load_png('world/platforms/grass.png')
def init_parallax_ressources(width,height): if parallax_ressources == {}: parallax_ressources['back'] = pygame.transform.scale(routines.load_png('world/trees/far-background.png')[0],(width,height)) parallax_ressources['front'] = pygame.transform.scale(routines.load_png('world/trees/near-background.png')[0],(width,height))