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
' change how we randomize and create the enemies | |
Method CreateEnemy() | |
Local rand_enemy:Float = Rnd(0, 3) | |
Local projectile_type:ProjectileType = New ProjectileType() | |
Local width = 48 | |
Local height = 32 | |
Local health = 1 | |
Local points = 10 | |
Local rand_y:Float = Rnd(height, Self.engine.GetCanvasHeight()) |
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
Class Game Extends App | |
'...................... | |
Field current_level:Int | |
' add field to hold new sprite sheet | |
Field game_sprite_atlas:ftSpriteAtlas | |
'....................... | |
Method OnCreate() | |
Self.engine = New CustomEngine | |
play_scene = engine.GetDefaultScene() |
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
Class Game Extends App | |
'...................... | |
Field current_level:Int | |
' add fields to hold new player image | |
Field player_image:Image | |
Const FINAL_LEVEL:Int = 2 | |
'................. |
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 OnUpdate() | |
'............... | |
Else | |
Self.final_boss.Update(engine.GetCanvasWidth(), engine.GetCanvasHeight()) | |
' change the boss' shooting pattern to 3 projectiles | |
If Self.final_boss.FireProjectile() | |
Local boss_width:Float = final_boss.box.GetWidth() | |
Local boss_height:Float = final_boss.box.GetHeight() | |
CreateProjectile(final_boss, 100, boss_height/2 * -1) |
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
' CustomEngine class | |
Method OnObjectCollision:Int(obj_one:ftObject, obj_two:ftObject) | |
If (obj_one.GetText() = "PLAYER" And (obj_two.GetText() = "ENEMY" Or obj_two.GetText() = "FINALBOSS")) | |
CharacterCollision(obj_one, obj_two) | |
Else If (obj_two.GetText() = "PLAYER" And (obj_one.GetText() = "ENEMY" Or obj_one.GetText() = "FINALBOSS")) | |
CharacterCollision(obj_two, obj_one) | |
End | |
'Update projectile collision to check for collision with the player | |
If (obj_one.GetText() = "PROJECTILE" And |
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 OnUpdate() | |
' .............. | |
Else | |
Self.final_boss.Update(engine.GetCanvasWidth(), engine.GetCanvasHeight()) | |
' Have the Boss shoot | |
If Self.final_boss.FireProjectile() | |
CreateProjectile(final_boss) | |
End | |
End |
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 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) | |
' reset the game if the player won or lost |
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
#FantomX_UsePhysics = True | |
Import fantomX | |
Import character | |
Import projectile | |
Import custom_engine | |
Class Game Extends App | |
Field engine:ftEngine |
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
#FantomX_UsePhysics = True | |
Import fantomX | |
Import character | |
Import projectile | |
Import custom_engine | |
Class Game Extends App | |
Field engine:ftEngine |
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 NextLevel() | |
game_state = STATE_LEVEL | |
start_time = Millisecs() | |
next_level_scene.SetActive(False) | |
next_level_scene.SetVisible(False) | |
game_over_scene.SetVisible(False) | |
play_scene.SetActive(True) | |
play_scene.SetAlpha(1.0) | |
For Local enemy:Character = Eachin Self.enemies | |
enemy.box.Remove() |