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 | |
Class Game Extends App | |
Field engine:ftEngine | |
Field default_layer:ftLayer | |
Field default_scene:ftScene |
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
Import fantomX | |
Class Character | |
Field box:ftObject | |
Field is_player:Bool | |
Method New(box:ftObject, player:Bool=False) | |
Self.box = box | |
Self.is_player = player |
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 OnCreate() | |
engine = New ftEngine | |
default_scene = engine.GetDefaultScene() | |
default_layer = engine.GetDefaultLayer() | |
Local box:ftObject = engine.CreateBox(120, 20, engine.GetCanvasWidth()/2, engine.GetCanvasHeight()/2) | |
box.SetColor(0, 70, 70) | |
box.SetMaxSpeed(20.0) | |
box.SetMinSpeed(-20.0) |
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 | |
Class Game Extends App | |
Field engine:ftEngine | |
Field default_layer:ftLayer | |
Field default_scene:ftScene |
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 | |
Class Game Extends App | |
Field engine:ftEngine | |
Field default_layer:ftLayer | |
Field default_scene:ftScene |
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
Field last_enemy_time:Float | |
Field next_enemy_interval:Float | |
' create named collision groups | |
Const PLAYER_GROUP:Int = 1 | |
Const ENEMY_GROUP:Int = 2 | |
Method OnCreate() | |
Self.engine = New 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
Import fantomX | |
Class CustomEngine Extends ftEngine | |
Method OnObjectCollision:Int(obj_one:ftObject, obj_two:ftObject) | |
If (obj_one.GetText() = "PLAYER" And obj_two.GetText() = "ENEMY") | |
obj_two.SetText("DESTROYED") | |
obj_two.SetColWith(obj_one.GetColGroup(), False) | |
Else If (obj_two.GetText() = "PLAYER" And obj_one.GetText() = "ENEMY") | |
obj_one.SetText("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
' in OnCreate | |
box.SetColGroup(PLAYER_GROUP) | |
box.SetColType(Self.engine.ctBox) | |
' Player box text | |
box.SetText("PLAYER") | |
Method OnUpdate() | |
Local time_delta:Float = Float(engine.CalcDeltaTime())/60.0 | |
If ((Millisecs() - Self.last_enemy_time) > Self.next_enemy_interval) |
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
Import fantomX | |
Class Character | |
Field box:ftObject | |
' Give characters health | |
Field current_health:Int | |
Field max_health:Int | |
Field is_player:Bool | |
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 | |
' ............. | |
Method OnCreate() | |
Self.engine = New CustomEngine | |
default_scene = engine.GetDefaultScene() | |
default_layer = engine.GetDefaultLayer() | |