Last active
January 3, 2017 00:00
-
-
Save codetravis/731cc19c548f120af127d1f69f15356f to your computer and use it in GitHub Desktop.
10.4 Call the GameReset method when the ENTER key is pressed
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) | |
' Manage the visibility of the game over scene | |
game_over_scene.SetVisible(True) | |
game_over_scene.SetAlpha(1.0) | |
' Reset the game if the player hits ENTER during game over | |
Else If (game_over_scene.isActive) | |
If (KeyDown(KEY_ENTER)) | |
ResetGame() | |
End | |
Else | |
If ((Millisecs() - Self.last_enemy_time) > Self.next_enemy_interval) | |
CreateEnemy() | |
Self.last_enemy_time = Millisecs() | |
End | |
' ........ | |
End |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment