Have any questions?

+44 (20) 3540 6226

hello@appshed.com

Variables available in JavaScript

For Visible Objects (such as a sprite) the Action for the Sprite will become part of the create() function. Any code that you write in the JavaScript editor will be run during create().

 spreite action

 

Variables available in the Action

Within the Action (the create() code) you have access to the following variables:

object

"object" is a variable created for this game object, e.g. "sprite1". The variable "object" is just a reference to the current game object. It can be referenced as such e.g.

   console.log(object.width)

<other_game_object>

All other game objects will be available using their unique Object Name.
e.g. "gameConfig" or "collider1" or "audio2" e.g.

     audio2.play()

 

  • Thursday, 23 May 2019

appshed name white text 250

Copyright © 2017 AppShed Limited