Skip to content

Instantly share code, notes, and snippets.

@codetravis
Last active January 3, 2017 00:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codetravis/731cc19c548f120af127d1f69f15356f to your computer and use it in GitHub Desktop.
Save codetravis/731cc19c548f120af127d1f69f15356f to your computer and use it in GitHub Desktop.
10.4 Call the GameReset method when the ENTER key is pressed
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