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
Return type
destroy
let destroy: T.t => unitParameters
Return type
get
let get: (T.t, 'tag) => array<'t>Parameters
Return type
getChildren
Get all children game objects. Be careful with the generic type you use.
let getChildren: T.t => array<'child>Parameters
Return type
getId
let getId: T.t => intParameters
Return type
has
Check if game object has a certain component.
let has: (T.t, string) => boolParameters
Return type
onDestroy
let onDestroy: (T.t, unit => unit) => Kaplay.KEventController.tParameters
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
Return type
onUpdateWithController
let onUpdateWithController: (T.t, unit => unit) => Kaplay.KEventController.tParameters
Return type
removeAll
Remove all children.
let removeAll: T.t => unitParameters
Return type
trigger
Trigger a custom event on this game object.
let trigger: (T.t, string, 'arg) => unitParameters
Return type
untag
let untag: (T.t, 'tag) => unitParameters
Return type
unuse
let unuse: (T.t, string) => unitParameters
Return type
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
Types
t
type tValues
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, array<Kaplay.Types.comp>) => 'tParameters
Return type
destroy
let destroy: t => unitParameters
Return type
get
let get: (t, 'tag) => array<'t>Parameters
Return type
getChildren
Get all children game objects. Be careful with the generic type you use.
let getChildren: t => array<'child>Parameters
Return type
getId
let getId: t => intParameters
Return type
has
Check if game object has a certain component.
let has: (t, string) => boolReturn type
onDestroy
let onDestroy: (t, unit => unit) => Kaplay.KEventController.tReturn type
onKeyDown
Holding the key down
let onKeyDown: (t, Kaplay.Types.key => unit) => Kaplay.KEventController.tReturn type
onKeyPress
Hitting the key
let onKeyPress: (t, Kaplay.Types.key => unit) => Kaplay.KEventController.tReturn type
onKeyRelease
Lifting the key up
let onKeyRelease: (t, Kaplay.Types.key => unit) => Kaplay.KEventController.tReturn type
onUpdate
let onUpdate: (t, unit => unit) => unitReturn type
onUpdateWithController
let onUpdateWithController: (t, unit => unit) => Kaplay.KEventController.tReturn type
removeAll
Remove all children.
let removeAll: t => unitParameters
Return type
trigger
Trigger a custom event on this game object.
let trigger: (t, string, 'arg) => unitReturn type
untag
let untag: (t, 'tag) => unitParameters
Return type
unuse
let unuse: (t, string) => unitReturn type
use
use(t, comp) add a game component to this game object.
Useful for adding conditional components after creation.
let use: (t, Kaplay.Types.comp) => unit