def enter(): gfw.world.init([ 'bg', 'enemy', 'boss', 'bullet', 'player', 'boss_bullet', 'effect', 'ui', 'item' ]) global player, charnum player = Player() Player.player_type = charnum gfw.world.add(gfw.layer.player, player) global dis_score, score dis_score = Score(canvas_width - 20, canvas_height - 50) gfw.world.add(gfw.layer.ui, dis_score) score = Score(canvas_width - 20, canvas_height - 100) gfw.world.add(gfw.layer.ui, score) global font font = gfw.font.load(gobj.RES_DIR + '/BM.ttf', 40) life_gauge.load() bg = VertScrollBackground('/map_01.png') bg.speed = 100 gfw.world.add(gfw.layer.bg, bg) global power_item, dual_item power_item = gfw.image.load(gobj.RES_DIR + '/powershot.png') dual_item = gfw.image.load(gobj.RES_DIR + '/dualshot.png') global music_bg, music_bg2, wav_mon_die, player_voice, player_hit_wav, wav_boss_dead, wav_siren, get_money, get_item music_bg = load_music(gobj.RES_DIR + '/bg_music.mp3') music_bg2 = load_music(gobj.RES_DIR + '/boss_stage_bg.mp3') wav_mon_die = load_wav(gobj.RES_DIR + '/enemy_die.wav') player_voice = load_wav(gobj.RES_DIR + '/go.wav') player_hit_wav = load_wav(gobj.RES_DIR + '/hit.wav') wav_siren = load_wav(gobj.RES_DIR + '/siren.wav') wav_boss_dead = load_wav(gobj.RES_DIR + '/boss_dead.wav') get_money = load_wav(gobj.RES_DIR + '/get_coin.wav') get_item = load_wav(gobj.RES_DIR + '/get_item.wav') music_bg.repeat_play() player_voice.play() global state state = START_GAME enemy_gen.reset() global boss_ox, boss_ap boss_ox, boss_ap = 0, 1 boss.Boss().LASER_INTERVAL = 0.5 global time, boss_die time = 0 boss_die = False highscore.load() Gameover_state.num = charnum
def enter(): gfw.world.init( ['bg', 'enemy', 'bullet', 'player', 'ui', 'bullet_enemy', 'item']) center = get_canvas_width() // 2, get_canvas_height() // 2 #background speed_city = 20 bg = VertScrollBackground('bg_city.png') bg.speed = speed_city gfw.world.add(gfw.layer.bg, bg) speed_clouds = 30 bg = VertScrollBackground('clouds.png') bg.speed = speed_clouds gfw.world.add(gfw.layer.bg, bg) global player player = Player() #player.bg=bg gfw.world.add(gfw.layer.player, player) global boss global score score = Score(canvas_width - 20, canvas_height - 50) gfw.world.add(gfw.layer.ui, score) global font font = gfw.font.load(gobj.RES_DIR + '/segoeprb.ttf', 40) life_gauge.load() global music_bg, wav_item, wav_enemydead, wav_enemyhit, wav_playerhit, game_over_image music_bg = load_music('res/04.mp3') wav_item = load_wav('res/item.wav') wav_enemydead = load_wav('res/enemydead.wav') wav_enemyhit = load_wav('res/enemyhit.wav') wav_playerhit = load_wav('res/playerhit.wav') game_over_image = gfw.image.load('res/game_over.png') global player_life global item music_bg.repeat_play() global state state = STATE_IN_GAME
def enter(): gfw.world.init(['bg', 'enemy', 'bullet', 'player', 'ui']) global player player = Player() gfw.world.add(gfw.layer.player, player) global score score = Score(canvas_width - 20, canvas_height - 50) gfw.world.add(gfw.layer.ui, score) global font font = gfw.font.load(gobj.RES_DIR + '/segoeprb.ttf', 40) life_gauge.load()
def enter(): gfw.world.init(['bg', 'monster', 'unit', 'unit', "gameclear"]) Monster.load_all_images() Unit.load_all_images() life_gauge.load() gameclear.load() global selectedUnit if load(): unit = gfw.world.object(gfw.layer.unit, 0) else: unit = Unit(1) selectedUnit = unit gfw.world.add(gfw.layer.unit, unit) gfw.world.add(gfw.layer.unit, Unit(1)) gfw.world.add(gfw.layer.unit, Unit(1)) gfw.world.add(gfw.layer.unit, Unit(1)) bg = gobj.ImageObject('background.jpg', (canvas_width // 2, canvas_height // 2)) gfw.world.add(gfw.layer.bg, bg) magic_circle = gobj.ImageObject( 'magic.png', (gobj.magic_circle_pos[0], gobj.magic_circle_pos[1])) gfw.world.add(gfw.layer.bg, magic_circle) global font, font2 font = gfw.font.load(gobj.RES_DIR + '/Sweet_story.otf', 50) font2 = gfw.font.load(gobj.RES_DIR + '/ConsolaMalgun.ttf', 20) global monster_time monster_time = 1 global monster_level monster_level = 1 global monster_level_up_time monster_level_up_time = 50 global unit_time unit_time = 50 global music_bg, end_music music_bg = load_music('res/Track 5.mp3') music_bg.set_volume(10) end_music = load_music('res/Track 26.mp3') end_music.set_volume(10) music_bg.repeat_play()
def enter(): gfw.world.init(['bg', 'enemy', 'bullet', 'player', 'ui', 'enemybullet']) global player player = Player() gfw.world.add(gfw.layer.player, player) global score score = Score(canvas_width - 20, canvas_height - 50) gfw.world.add(gfw.layer.ui, score) global font font = gfw.font.load(gobj.RES_DIR + '/segoeprb.ttf', 40) global bg bg = VertScrollBackground('../res/background.png', 10) gfw.world.add(gfw.layer.bg, bg) life_gauge.load()
def enter(): gfw.world.init(['bg', 'missile', 'player', 'bullet', 'boss', 'ui']) pattern.init() global player player = Player() gfw.world.add(gfw.layer.player, player) global boss boss = Boss() gfw.world.add(gfw.layer.boss, boss) global bg bg = VertScrollBackground('./res/world02.png') leaf = VertScrollBackground('./res/world02c2.png') gfw.world.add(gfw.layer.bg, bg) gfw.world.add(gfw.layer.bg, leaf) global font font = gfw.font.load('res/ConsolaMalgun.ttf', 20) global sound_damage, sound_pldead, music_bg music_bg = load_music('res/bg_sound.mp3') sound_damage = load_wav('res/se_damage00.wav') sound_pldead = load_wav('res/se_pldead00.wav') sound_damage.set_volume(20) sound_pldead.set_volume(20) music_bg.set_volume(50) global pattern_index pattern_index = 0 p1 = pattern.Pattern1() pattern.add(p1) p2 = pattern.Pattern2() pattern.add(p2) life_gauge.load() highscore.load() start_game()
def enter(): gfw.world.init(['bg', 'enemy', 'bullet', 'player', 'cloud', 'ui']) global player player = Player() gfw.world.add(gfw.layer.player, player) bg = VertScrollBackground('bg_city.png') bg.speed = 10 gfw.world.add(gfw.layer.bg, bg) cloud = VertScrollBackground('clouds.png') cloud.speed = 20 gfw.world.add(gfw.layer.cloud, cloud) global score score = Score(canvas_width - 20, canvas_height - 50) gfw.world.add(gfw.layer.ui, score) global font font = gfw.font.load(gobj.RES_DIR + '/segoeprb.ttf', 40) life_gauge.load()
def enter(): gfw.world.init([ 'bg', 'enemy', 'bullet', 'player', 'ui', 'e_bullet', 'coin', ]) center = get_canvas_width() // 2, get_canvas_height() // 2 bg = VertScrollBackground('bg_01.png') bg.speed = 100 gfw.world.add(gfw.layer.bg, bg) global music_bgm, monster_bgm, attacked_bgm, coin_bgm music_bgm = load_music('res/dragon_flight.mp3') music_bgm.repeat_play() monster_bgm = load_wav('res/monster_die.wav') attacked_bgm = load_wav('res/attacked.wav') coin_bgm = load_wav('res/coin.wav') global player player = Player() player.bg = bg gfw.world.add(gfw.layer.player, player) global score score = Score(canvas_width // 2 + 40, canvas_height - 20) gfw.world.add(gfw.layer.ui, score) global font font = gfw.font.load(gobj.RES_DIR + '/segoeprb.ttf', 40) life_gauge.load() skill_gauge.load()