Skip to content

Instantly share code, notes, and snippets.

@codetravis
Created November 26, 2016 18:23
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/bc5b7a9f24700ca1185f38d4fd2f0d97 to your computer and use it in GitHub Desktop.
Save codetravis/bc5b7a9f24700ca1185f38d4fd2f0d97 to your computer and use it in GitHub Desktop.
6.2 Creating a box and adding it to the Character class
' 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