Created
January 6, 2017 22:52
-
-
Save codetravis/1465f38a1d865a9f807a0f551587bb48 to your computer and use it in GitHub Desktop.
11.8 Add transition to next level scene when boss is destroyed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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