Created
December 28, 2016 13:28
-
-
Save codetravis/6701aed5ddc5d0a2ac20946f4de3bc4d to your computer and use it in GitHub Desktop.
9.2 Add some text to your game over scene
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
' Game Class | |
Method OnCreate() | |
Self.engine = New CustomEngine | |
' rename defaults | |
play_scene = engine.GetDefaultScene() | |
play_layer = engine.GetDefaultLayer() | |
play_scene.AddLayer(play_layer) | |
Local box:ftObject = Self.engine.CreateBox(120, 20, engine.GetCanvasWidth()/2, engine.GetCanvasHeight()/2) | |
box.SetColor(0, 70, 70) | |
box.SetMaxSpeed(20.0) | |
box.SetMinSpeed(-20.0) | |
box.SetColGroup(PLAYER_GROUP) | |
box.SetColType(Self.engine.ctBox) | |
box.SetText("PLAYER") | |
Local projectile_type:ProjectileType = New ProjectileType() | |
Self.player = New Character(box, projectile_type, 0, 3, True) | |
Self.enemies = New List<Character>() | |
Self.last_enemy_time = Millisecs() | |
Self.next_enemy_interval = 3000 | |
Self.projectiles = New List<Projectile>() | |
' create our game over scene | |
game_over_scene = engine.CreateScene() | |
game_over_layer = engine.CreateLayer() | |
game_over_scene.AddLayer(game_over_layer) | |
' add some things to the game over scene | |
engine.SetDefaultLayer(game_over_layer) | |
' Font created with Hiero (rename .fnt file to .txt) | |
Local font:ftFont = engine.LoadFont("vt323_sample_2.txt") | |
Local game_over_text:ftObject = engine.CreateText(font, "GAME OVER", | |
engine.GetCanvasWidth()/3, engine.GetCanvasHeight()/2, engine.taBottomLeft) | |
game_over_scene.SetActive(False) | |
engine.SetDefaultLayer(play_layer) | |
Seed = Millisecs() | |
End |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment