Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
11.8 Add transition to next level scene when boss is destroyed
Method OnUpdate()
Local time_delta:Float = Float(engine.CalcDeltaTime())/60.0
If (player.box.GetText() = "DESTROYED" And play_scene.isActive)
play_scene.SetActive(False)
game_over_scene.SetActive(True)
game_over_scene.SetVisible(True)
game_over_scene.SetAlpha(1.0)
Else If (game_over_scene.isActive)
If (KeyDown(KEY_ENTER))
ResetGame()
End
' Check to move out of next level scene
Else If (next_level_scene.isActive)
If (KeyDown(KEY_ENTER))
NextLevel()
End
Else
If (Self.game_state = STATE_LEVEL)
If (Millisecs() - Self.start_time > Self.boss_time)
Self.game_state = STATE_BOSS
CreateFinalBoss()
Else If ((Millisecs() - Self.last_enemy_time) > Self.next_enemy_interval)
CreateEnemy()
Self.last_enemy_time = Millisecs()
End
Else If (Self.game_state = STATE_BOSS)
' move to the next level scene if the boss is destroyed
If (final_boss.box.GetText() = "DESTROYED" And play_scene.isActive)
Self.player.IncreaseScore(final_boss.point_value)
play_scene.SetActive(False)
next_level_scene.SetActive(True)
next_level_scene.SetVisible(True)
next_level_scene.SetAlpha(1.0)
Else
Self.final_boss.Update(engine.GetCanvasWidth(), engine.GetCanvasHeight())
End
End
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment