Kaplay.GameObjRaw
Modules
Comp
Values
addChild
Add a game object from an array of components.
Caution: child positions are relative to the parent! If you use addPos inside the child, it will be relative to the parent.
let addChild: (T.t, array<Kaplay.Types.comp>) => 'tParameters
T.t
Return type
array < Kaplay.Types.comp >
destroy
let destroy: T.t => unitParameters
T.t
Return type
unit
get
let get: (T.t, 'tag) => array<'t>Parameters
T.t
Return type
array
getChildren
Get all children game objects. Be careful with the generic type you use.
let getChildren: T.t => array<'child>Parameters
T.t
Return type
array
getId
let getId: T.t => intParameters
T.t
Return type
int
has
Check if game object has a certain component.
let has: (T.t, string) => boolParameters
T.t
string
Return type
bool
onDestroy
let onDestroy: (T.t, unit => unit) => Kaplay.KEventController.tParameters
T.t
unit
unit
Return type
onKeyDown
Holding the key down
let onKeyDown: (T.t, Kaplay.Types.key => unit) => Kaplay.KEventController.tReturn type
onKeyPress
Hitting the key
let onKeyPress: (T.t, Kaplay.Types.key => unit) => Kaplay.KEventController.tReturn type
onKeyRelease
Lifting the key up
let onKeyRelease: (T.t, Kaplay.Types.key => unit) => Kaplay.KEventController.tReturn type
onUpdate
let onUpdate: (T.t, unit => unit) => unitParameters
T.t
unit
unit
Return type
unit
onUpdateWithController
let onUpdateWithController: (T.t, unit => unit) => Kaplay.KEventController.tParameters
T.t
unit
unit
Return type
removeAll
Remove all children.
let removeAll: T.t => unitParameters
T.t
Return type
unit
trigger
Trigger a custom event on this game object.
let trigger: (T.t, string, 'arg) => unitParameters
T.t
string
Return type
unit
untag
let untag: (T.t, 'tag) => unitParameters
T.t
Return type
unit
unuse
let unuse: (T.t, string) => unitParameters
T.t
string
Return type
unit
use
use(t, comp) add a game component to this game object.
Useful for adding conditional components after creation.
let use: (T.t, Kaplay.Types.comp) => unitReturn type
unit