extends SceneTree var starts := 0 var wins := 0 var losses := 0 func _initialize() -> void: call_deferred("run") func run() -> void: var g = load("res://games/frogger/Frogger.tscn").instantiate() root.add_child(g) g.set_physics_process(false) g.music_enabled = false g.game_started.connect(func(): starts += 1) g.game_won.connect(func(): wins += 1) g.game_lost.connect(func(): losses += 1) g.high_score = 12345 g.score = 1230 for cycle in range(2): g._physics_process(44) assert(g.demo_active and not g.is_running) var highest := 232.0 var arrivals := 0 for frame in range(1921): g._physics_process(1.0/60) highest = minf(highest,g.frog.y) arrivals = maxi(arrivals,g.homes.count(true)) assert(not g.demo_active and g.phase == "scores") assert(g.score == 1230 and g.high_score == 12345 and g.leaderboard.is_empty()) assert(starts == 0 and wins == 0 and losses == 0) assert(highest <= 104, "Demo never reached river") print("Demo cycle ",cycle," highest y=",highest," homes=",arrivals) g._physics_process(7.1) assert(g.phase == "title" and g.attract_time == 0) for state in ["title","scores","demo"]: g.phase = state if state == "demo": g.begin_demo() assert(g.start_game()) assert(not g.demo_active and g.phase == "ready" and g.score == 0) assert(g.lives == g.starting_lives and not g.homes.has(true)) g.reset_game() assert(starts == 3 and wins == 0 and losses == 0) print("Attract isolation, cycling, interruption: PASS") g.free() quit()