Instantly share code, notes, and snippets.

Embed
What would you like to do?
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