def test_combinations(): """Tests reading and updating the combinations txt file""" assert "temp.txt" not in os.listdir(".") assert not generator.check(filename="temp.txt", combination=OUTPUT) generator.update(filename="temp.txt", combination=OUTPUT) assert generator.check(filename="temp.txt", combination=OUTPUT) os.remove("temp.txt")
def update(): if state != STATE_IN_GAME: return global score score += gfw.delta_time gfw.world.update() generator.update(score) check_collision()
def update(): global state, score if state != STATE_IN_GAME: return score += gfw.delta_time gfw.world.update() generator.update(score) dead, full = check_collision() if dead: end_game() if full: score += 5
def update(): gfw.world.update() generator.update() # if not gfw.world.count_at(gfw.layer.enemy) == 0: # for n in gfw.world.objects_at(gfw.layer.enemy): # print(n) collision.check_collision() score.update() #print(gfw.world.count_at(gfw.layer.enemy)) pattern.update() stage_gen.update()
def update(): global state if state == GAME_OVER: return if paused: paused_update() return gfw.world.update() generator.update(playtime()) for b in gfw.world.objects_at(gfw.world.layer.book): check_book(b) for i in gfw.world.objects_at(gfw.world.layer.item): check_item(i) score.score += gfw.delta_time exam_time(generator.exam) update_music()
def update(): global start if Zombie.GAME_OVER == True: gfw.world.clear() Zombie.GAME_OVER = False gfw.change(over_state) return gfw.world.update() generator.update() check_collision_bullet_zombie() check_collision_plant_zombie() check_collision_zombie_car() global zombie_generate_time zombie_generate_time += gfw.delta_time if zombie_generate_time > START_TIME and start == False: generator.generate_zombie_start() zombie_generate_time = 0 start = True elif start == False: return if zombie_generate_time > ZOMBIE_TIME and generator.Zombie_Generate_num < ZOMBIE_NUM: zombie_generate_time = 0 type = random.choice( ['ConeheadZombie', 'BucketheadZombie', 'FlagZombie']) generator.generate_zombie(type) # 시작했고 좀비가 다 비었으면 5초후에 Final wave 띄우고 마지막 좀비 공격 시작 global FINAL_GAP_TIME if start == True and gfw.world.count_at( gfw.layer.zombie) == 0 and FINAL_GAP_TIME <= 5: FINAL_GAP_TIME += gfw.delta_time if FINAL_GAP_TIME > 5: for i in range(20): type = random.choice([ 'ConeheadZombie', 'BucketheadZombie', 'FlagZombie', 'Zombie' ]) z = generator.generate_zombie(type) static_ui.FINAL_WAVE = True if FINAL_GAP_TIME > 5 and gfw.world.count_at(gfw.layer.zombie) == 0: gfw.change(clear_state) if static_ui.FINAL_WAVE and gfw.world.count_at(gfw.layer.zombie) != 0: static_ui.FINAL_WAVE = False
def update(): if state != STATE_IN_GAME: # 게임 오버 구현 return global score score += gfw.delta_time # delta 타임 값을 계속 더해줌 gfw.world.update() # 월드 업데이트 generator.update(score) # 점수에 따른 미사일 생성 check_collision() # 충돌 체크 # 플레이어가 떨어질 때 타일과 충돌하는지 검사합니다. if player.speed_y < 0.0: player_half_w = player.col_box_w * 0.5 player_half_h = player.col_box_h * 0.5 player_left = player.pos[0] - player_half_w player_right = player.pos[0] + player_half_w player_bottom = player.pos[1] - player_half_h player_top = player.pos[1] + player_half_h for i in gfw.world.objects_at(gfw.layer.tile): x, y = i.pos[0], i.pos[1] half_w = 80.0 * 0.5 half_h = 20.0 * 0.5 left = x - half_w right = x + half_w bottom = y - half_h top = y + half_h if player.pos[1] > y and player_left <= right and player_right >= left and player_bottom <= top and player_top >= bottom: player.pos = player.pos[0], y + 30.0 player.jump = False player.speed_y = 0.0 break if player.life <= 0: end_game()
def update(): gfw.world.update() generator.update() check_collision()
def update(): gfw.world.update() generator.update()
def update(self): """Calls the function in the generator library""" generator.update(self)