How to write a script in CoSpaces


#1

You can open the built-in code editor by clicking on the “Code” icon in the upper right hand corner.
code1

Then you can decide whether you want to code in Blockly or in JavaScript/TypeScript.
code2

Now you can start coding, toggle between JavaScript and TypeScript and open up to five different scripting tabs. The round “Info” icon on the right side leads you to the JavaScript/TypeScript API documentation containing descriptions of all public methods and additional code snippets.

When your script is ready you can just click on the “Play” button to run your program. CoSpaces switches into “Play” mode executing your script.
code4

To stop the execution of your script and leave “Play” mode click on the “Back” button in the upper left hand corner. Now you’re back in “Build” mode where you can work on your scene and keep working on your script.

For tutorials on how to use Blockly visit our YouTube channel.