Created
November 26, 2016 18:23
-
-
Save codetravis/bc5b7a9f24700ca1185f38d4fd2f0d97 to your computer and use it in GitHub Desktop.
6.2 Creating a box and adding it to the Character class
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
' main.monkey OnCreate class | |
Method OnCreate() | |
engine = New ftEngine | |
default_scene = engine.GetDefaultScene() | |
default_layer = engine.GetDefaultLayer() | |
' create a box ftObject | |
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) | |
' create the player character | |
Self.player = New Character(box) | |
End | |
'---------------------------------------- | |
' character.monkey | |
Import fantomX | |
Class Character | |
Field box:ftObject | |
Method New(box:ftObject) | |
Self.box = box | |
End | |
End | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment