def __init__(self): CharacterData.__init__(self) #super(CharacterData, self).__init__() self.load('Resources/Sprites/Finn.json') self.x = 320 self.y = 480 self.speed = Finn.MPS self.frame_time = 0.05 if Finn.image is None: Finn.image = pico2d.load_image(self.name) #pico2d_extension.set_texture_color(Finn.image.texture, 255, 255, 255) if Finn.sounds is None: Finn.sounds = [] damage_sound = pico2d.load_wav('Resources/Sounds/Damage01.wav') damage_sound.set_volume(32) Finn.sounds.append(damage_sound) damage_sound = pico2d.load_wav('Resources/Sounds/Damage02.wav') damage_sound.set_volume(32) Finn.sounds.append(damage_sound) damage_sound = pico2d.load_wav('Resources/Sounds/Damage03.wav') damage_sound.set_volume(32) Finn.sounds.append(damage_sound)
def enter_state(): global clear_font global clear_voice global clear_sfx global clear_message_font global clear_score_font global camera camera = MainState.camera camera.shake_camera() clear_font = pico2d.load_font('resource\\NecroSans.ttf', 82) clear_score_font = pico2d.load_font('resource\\NecroSans.ttf', 50) clear_message_font = pico2d.load_font('resource\\malgunbd.ttf', 30) clear_sfx = pico2d.load_wav('resource\\sound\\sfx_secretfound.wav') clear_sfx.set_volume(100) for i in range(3): bgm = pico2d.load_wav('resource\\sound\\vo_cad_yeah_0' + str(i + 2) + '.wav') bgm.set_volume(90) clear_voice.append(bgm) ran_val = random.randint(0, 2) clear_sfx.play() clear_voice[ran_val].play() pass
def enter(): global player, cars, coins, info, fires, player_data, bg, start_time, wav_lev, collision_check_thread, is_over player = Player() fires = [] info = Info() coins = [] cars = [] lev = player.car.level global NUM_CAR NUM_CAR = (garage_state.garage.difficulty + 1) * 20 for i in range(NUM_CAR): #내 차보다 최대 2레벨 높은것만 나오도록 cars.append( Car(random.randrange(0, lev + 2 if lev + 2 < MAX_LEV else MAX_LEV))) bg = background.Background() global bgm, gameover_bgm, get_coin_bgm bgm = pico2d.load_music('res/sound/bgm.mp3') gameover_bgm = pico2d.load_wav('res/sound/dead.wav') get_coin_bgm = pico2d.load_wav('res/sound/coin.wav') bgm.set_volume(64) gameover_bgm.set_volume(64) get_coin_bgm.set_volume(64) bgm.repeat_play() wav_lev = 1 is_over = False collision_check1 = threading.Thread(target=collides_car) collision_check1.start() collision_check2 = threading.Thread(target=collides_bullet) collision_check2.start()
def enter_state(): global dead_font global dead_voice global dead_sfx global dead_message_font global dead_score_font global camera global get_damage_image camera = MainState.camera camera.shake_camera() get_damage_image = Camera.HitImage() GameWorldManager.add_object(get_damage_image, MainState.LAYER_MESSAGE) dead_font = pico2d.load_font('resource\\NecroSans.ttf', 82) dead_score_font = pico2d.load_font('resource\\NecroSans.ttf', 50) dead_message_font = pico2d.load_font('resource\\malgunbd.ttf', 30) dead_sfx = pico2d.load_wav('resource\\sound\\hit_sound\\sfx_player_death_ST.wav') dead_sfx.set_volume(100) for i in range(3): bgm = pico2d.load_wav('resource\\sound\\hit_sound\\vo_cad_death_0' + str(i + 1) + '.wav') bgm.set_volume(90) dead_voice.append(bgm) ran_val = random.randint(0, 2) dead_sfx.play() dead_voice[ran_val].play() pass
def add_effect_sound(music_direction, music_name): if music_name not in SoundManager.sound_dict: SoundManager.sound_dict[music_name] = pico2d.load_wav( music_direction) else: obj = SoundManager.sound_dict.pop(music_name) del obj SoundManager.sound_dict[music_name] = pico2d.load_wav( music_direction)
def __init__(self): self.image = pico2d.load_image('resource\\Character_Player.png') self.pivot = Point(1000, 345) self.frame = {'x': 0, 'y': 0} self.rad = 0 self.flip = '' # for jump self.check_jumping = False self.jumping_count = 0 self.start_point = self.pivot self.mid_point = self.pivot self.end_point = self.pivot self.jump_dir = 'RIGHT' self.start_jumping_time = 0.0 self.check_moving_collide = False self.event_que = [] self.init_state = IdleState self.curr_state = IdleState self.curr_state.enter_state(self, None) # hit_damage self.curr_hp = 12 self.max_hp = 12 self.check_get_damage = False self.get_damage_timer = self.HIT_TIMER self.get_damage_image = Camera.HitImage() # money self.holding_gold = 0 self.holding_diamond = 0 # attack self.equip_shovel = Shovel_Type['SHOVEL_TITANIUM'] self.equip_weapon = Weapon_Type['WEAPON_DAGGER_BASIC'] self.equip_weapon_object = Dagger_Attack(self.pivot.x, self.pivot.y) self.equip_body = 0 self.equip_head = 0 # sound self.hit_voice = [] self.hit_bgm = pico2d.load_wav('resource\\sound\\hit_sound\\sfx_player_hit_ST.wav') self.hit_bgm.set_volume(100) for i in range(6): bgm = pico2d.load_wav('resource\\sound\\hit_sound\\vo_cad_hurt_0' + str(i+1) + '.wav') bgm.set_volume(90) self.hit_voice.append(bgm) pass # view self.view_range = 2
def __init__(self, px=None, py=None): super().__init__() if Skeleton_Knight.death_sound is None: Skeleton_Knight.death_sound = pico2d.load_wav( 'resource\\sound\\mob_sound\\en_skeleton_knight_death.wav') Skeleton_Knight.death_sound.set_volume(100) Skeleton_Knight.hit_sound = pico2d.load_wav( 'resource\\sound\\mob_sound\\en_skeleton_knight_attack.wav') Skeleton_Knight.hit_sound.set_volume(100) if Skeleton_Knight.image is None: Skeleton_Knight.image = pico2d.load_image( 'resource\\Monster_Skeleton_Knights.png') pass if px is None and py is None: self.pivot = Point(0, 0) else: self.pivot = Point(px, py) pass self.type = Monster_Type['MONSTER_SKELETON_KNIGHT'] self.max_hp = 3 self.curr_hp = 3 self.damage = 2 self.object_width = 36 self.object_height = 42 self.image_start_point = [ Point(0, self.image.h - self.object_height), Point(36, self.image.h - self.object_height), Point(72, self.image.h - self.object_height), Point(108, self.image.h - self.object_height), Point(108, self.image.h - self.object_height), Point(108, self.image.h - self.object_height), Point(108, self.image.h - self.object_height) ] self.object_width = 36 self.object_height = 42 self.frame = 0 self.max_frame = 7 self.dir = None self.start_pivot = Point(self.pivot.x, self.pivot.y) self.move_timer = Skeleton_Knight.MOVE_TIMER self.bt = None self.build_behavior_tree()
def __init__(self, item_type=None, px=None, py=None): if Dropped_Item.shadow_image is None: Dropped_Item.shadow_image = pico2d.load_image( 'resource\\black_background.png') if Dropped_Item.get_sound is None: Dropped_Item.get_sound = pico2d.load_wav( 'resource\\sound\\obj_sound\\sfx_pickup_general_ST.wav') self.get_sound.set_volume(100) pass self.alpha_value = 1.0 if px is None and py is None: self.pivot = Point(500, 500) else: self.pivot = Point(px, py + 10) if item_type is None: self.value = DroppedItem_Type['ITEM_GOLD'] else: self.value = item_type self.image_start_point = None self.jump_max = 5 self.starting_y = self.pivot.y self.dir = 1 self.timer = self.MOVING_TIMER
def __init__(self, running_open=None, px=None, py=None): if NextFloor.image is None: NextFloor.image = pico2d.load_image('resource\\Block_Floors.png') NextFloor.shadow_image = pico2d.load_image( 'resource\\black_background.png') self.alpha_value = 1.0 if px is None and py is None: self.pivot = Point(500, 500) else: self.pivot = Point(px, py) if running_open is None: self.value = Block_Type['BLOCK_STAIR_CLOSED'] self.running_open = False if running_open: self.value = Block_Type['BLOCK_STAIR_OPENED'] self.running_open = True else: self.value = Block_Type['BLOCK_STAIR_CLOSED'] self.running_open = False self.open_sound = pico2d.load_wav( 'resource\\sound\\obj_sound\\sfx_use_key_to_unlock.wav')
def __init__(self): self.block_list = [] self.wall_list = [] # Monster.Bat_Basic(700, 350 + 20) self.monster_list = [ Monster.Slime_Green(600, 350 + 10), Monster.Slime_Green(600, 300 + 10), Monster.Bat_Basic(700, 350 + 20), Monster.Bat_Basic(700, 400 + 20), Monster.Bat_Basic(700, 450 + 20), Monster.Bat_Basic(650, 450 + 20), Monster.Skeleton_Knight(900, 100 - 5), Monster.Skeleton_Knight(350, -700 - 5), Monster.Slime_Green(750, -100 + 10), Monster.Slime_Green(500, -200 + 10), Monster.Slime_Green(500, -250 + 10), Monster.Bat_Basic(250, -550 + 20), Monster.Bat_Basic(350, -550 + 20), Monster.Bat_Basic(250, -450 + 20), Monster.Bat_Basic(350, -450 + 20), Monster.Banshee(0, -400 + 20), Monster.Slime_Green(950, 650 + 10) ] self.chest_list = [ BlockSet.Chest(BlockSet.Block_Type['BLOCK_RED_CHEST'], Dropped_Item.DroppedItem_Type['ITEM_TORCH_NORMAL'], 750, 100), BlockSet.Chest(BlockSet.Block_Type['BLOCK_RED_CHEST'], Dropped_Item.DroppedItem_Type['ITEM_TORCH_BASIC'], 950, 700), BlockSet.Chest(BlockSet.Block_Type['BLOCK_BLACK_CHEST'], Dropped_Item.DroppedItem_Type['ITEM_TORCH_BLUE'], 500, 500), BlockSet.Chest(BlockSet.Block_Type['BLOCK_BLACK_CHEST'], Dropped_Item.DroppedItem_Type['ITEM_HEAL'], 450, -450) ] self.item_list = [] self.init_map_objects() for block_object in self.block_list: GameWorldManager.add_object(block_object, MainState.LAYER_MAP) for wall_object in self.wall_list: GameWorldManager.add_object(wall_object, MainState.LAYER_MAP) for monster_object in self.monster_list: GameWorldManager.add_object(monster_object, MainState.LAYER_MONSTER) for chest_object in self.chest_list: GameWorldManager.add_object(chest_object, MainState.LAYER_ITEM) self.next_floor = BlockSet.NextFloor(False, 0, -450) GameWorldManager.add_object(self.next_floor, MainState.LAYER_EXIT) self.stage1_bgm = pico2d.load_wav('resource\\sound\\stage1_bgm.wav') self.stage1_bgm.set_volume(35) self.stage1_bgm.repeat_play() pass
def __init__(self, px=None, py=None): super().__init__() if Slime_Green.image is None: Slime_Green.image = pico2d.load_image( 'resource\\Monster_Slime.png') pass if Slime_Green.hit_sound is None: Slime_Green.hit_sound = pico2d.load_wav( 'resource\\sound\\mob_sound\\en_slime_hit.wav') Slime_Green.death_sound = pico2d.load_wav( 'resource\\sound\\mob_sound\\en_slime_death.wav') Slime_Green.hit_sound.set_volume(100) Slime_Green.death_sound.set_volume(100) if px is None and py is None: self.pivot = Point(0, 0) else: self.pivot = Point(px, py) pass self.type = Monster_Type['MONSTER_SLIME_GREEN'] self.max_hp = 2 self.curr_hp = 2 self.damage = 1 self.object_width = 26 self.object_height = 25 self.image_start_point = [ Point(0, self.image.h - self.object_height), Point(28, self.image.h - self.object_height), Point(54, self.image.h - self.object_height), Point(80, self.image.h - self.object_height) ] self.frame = 0 self.max_frame = 4 self.bt = None self.timer = 0.5 self.build_behavior_tree() self.start_pivot = Point(self.pivot.x, self.pivot.y) self.check_jumping = False
def __init__(self): CharacterData.__init__(self) #super(CharacterData, self).__init__() self.load('Resources/Sprites/Cubchoo.json') self.x = random.randint(400, 500) self.y = random.randint(400, 500) self.speed = random.randint(1, 3) * Cubchoo.MPS self.state = random.randint(1,8) self.frame_time = 0.1 if Cubchoo.image is None: Cubchoo.image = pico2d.load_image(self.name) if Cubchoo.hit_sound is None: Cubchoo.hit_sound = pico2d.load_wav('Resources/Sounds/Hit.wav') Cubchoo.hit_sound.set_volume(16) if Cubchoo.respone_sound is None: Cubchoo.respone_sound = pico2d.load_wav('Resources/Sounds/Respone.wav') Cubchoo.respone_sound.set_volume(8)
def __init__(self,x,y): EffectData.__init__(self) self.load('Resources/Effects/Warp.json') self.x = x self.y = y if WarpEffect.image is None: WarpEffect.image = pico2d.load_image(self.name) if WarpEffect.sound is None: WarpEffect.sound = pico2d.load_wav('Resources/Sounds/Warp.wav') WarpEffect.sound.set_volume(64)
def enter_state(): global fade_image global image global ready_font global ready_bgm fade_image = pico2d.load_image('resource\\black_background.png') image = pico2d.load_image('resource\\start_image.jpg') ready_font = pico2d.load_font('resource\\NecroSans.ttf', 56) ready_bgm = pico2d.load_wav('resource\\sound\\start_bgm.wav') ready_bgm.set_volume(35) ready_bgm.repeat_play() pass
def __init__(self, item_type=None, px=None, py=None): super().__init__(item_type, px, py) self.image = pico2d.load_image('resource\\item_image\\Consumables.png') self.heal_sound = pico2d.load_wav( 'resource\\sound\\obj_sound\\sfx_item_food.wav') self.heal_sound.set_volume(99) self.ITEM_IMAGE_WIDTH = 22 self.ITEM_IMAGE_HEIGHT = 22 if self.value is None: self.value = DroppedItem_Type['ITEM_HEAL'] else: self.value = item_type self.image_start_point = Point(72, self.image.h - 186)
def __init__(self, px=None, py=None): super().__init__() if Bat_Basic.death_sound is None: Bat_Basic.death_sound = pico2d.load_wav( 'resource\\sound\\mob_sound\\en_bat_death.wav') Bat_Basic.death_sound.set_volume(100) if Bat_Basic.image is None: Bat_Basic.image = pico2d.load_image('resource\\Monster_Bat.png') pass if px is None and py is None: self.pivot = Point(0, 0) else: self.pivot = Point(px, py) pass self.type = Monster_Type['MONSTER_BAT_BASIC'] self.max_hp = 1 self.curr_hp = 1 self.damage = 1 self.object_width = 24 self.object_height = 18 self.image_start_point = [ Point(2, self.image.h - self.object_height), Point(23, self.image.h - self.object_height), Point(48, self.image.h - self.object_height), Point(72, self.image.h - self.object_height), Point(72, self.image.h - self.object_height), Point(72, self.image.h - self.object_height), Point(72, self.image.h - self.object_height) ] self.frame = 0 self.max_frame = 7 self.dir = None self.start_pivot = Point(self.pivot.x, self.pivot.y) self.move_timer = Bat_Basic.MOVE_TIMER self.bt = None self.build_behavior_tree()
def __init__(self, x=None, y=None): self.image = pico2d.load_image('resource\\Effect_Weapon.png') self.pivot = Point(0, 0) if x is not None and y is not None: self.pivot = Point(x, y) self.frame = 0 self.rad = 0 self.flip = '' self.check_attack = False self.check_possible_attack = False self.attack_delay = Dagger_Attack.ATTACK_DELAY_TIMER self.timer = Dagger_Attack.ATTACK_TIMER self.dir = None self.damage = 1 self.attack_sound = [] for i in range(4): attack_sfx = pico2d.load_wav('resource\\sound\\attack_sound\\vo_cad_melee_1_0' + str(i + 1) + '.wav') attack_sfx.set_volume(100) self.attack_sound.append(attack_sfx) pass
def __init__(self, chest_type=None, item_value=None, px=None, py=None): if Chest.image is None: Chest.image = pico2d.load_image('resource\\Containers.png') Chest.shadow_image = pico2d.load_image( 'resource\\black_background.png') self.alpha_value = 1.0 if px is None and py is None: self.pivot = Point(500, 500) else: self.pivot = Point(px, py) if chest_type is None: self.value = Block_Type['BLOCK_RED_CHEST'] self.chest_item = Dropped_Item.DroppedItem_Type['ITEM_TORCH'] else: self.value = chest_type self.chest_item = item_value if Chest.open_sound is None: Chest.open_sound = pico2d.load_wav( 'resource\\sound\\obj_sound\\obj_chest_open.wav')
def __init__(self, px=None, py=None): super().__init__() if Banshee.death_sound is None: Banshee.death_sound = pico2d.load_wav( 'resource\\sound\\mob_sound\\en_banshee_death.wav') Banshee.death_sound.set_volume(100) Banshee.hit_sound.append( pico2d.load_wav( 'resource\\sound\\mob_sound\\en_banshee_hit_01.wav')) Banshee.hit_sound.append( pico2d.load_wav( 'resource\\sound\\mob_sound\\en_banshee_hit_02.wav')) Banshee.hit_sound.append( pico2d.load_wav( 'resource\\sound\\mob_sound\\en_banshee_hit_03.wav')) Banshee.hit_sound[0].set_volume(100) Banshee.hit_sound[1].set_volume(100) Banshee.hit_sound[2].set_volume(100) Banshee.cry_sound = pico2d.load_wav( 'resource\\sound\\mob_sound\\en_banshee_cry.wav') Banshee.cry_sound.set_volume(100) Banshee.rage_sound = pico2d.load_wav( 'resource\\sound\\mob_sound\\en_banshee_cry.wav') Banshee.rage_sound.set_volume(100) if Banshee.image is None: Banshee.image = pico2d.load_image('resource\\Monster_Banshee.png') pass if px is None and py is None: self.pivot = Point(0, 0) else: self.pivot = Point(px, py) pass self.type = Monster_Type['MONSTER_BANSHEE'] self.max_hp = 6 self.curr_hp = 6 self.damage = 2 self.non_find = False self.object_width = 25 self.object_height = 39 self.object_rage_width = 33 self.image_start_point = [ Point(21, self.image.h - self.object_height - 13), Point(54, self.image.h - self.object_height - 13), Point(87, self.image.h - self.object_height - 13), Point(122, self.image.h - self.object_height - 13), Point(147, self.image.h - self.object_height - 13), Point(181, self.image.h - self.object_height - 13), Point(215, self.image.h - self.object_height - 13), Point(249, self.image.h - self.object_height - 13) ] self.frame = 0 self.max_frame = 4 self.running_rage = False self.dir = None self.start_pivot = Point(self.pivot.x, self.pivot.y) self.move_timer = Banshee.MOVE_TIMER self.bt = None self.build_behavior_tree()
def load(cls, path, volume): if path not in cls.sounds: sound = pc.load_wav(path) sound.set_volume(volume) cls.sounds[path] = sound return cls.sounds[path]