Gamefroot’s Script Editor has just been given a massive upgrade! This new version is now powered by Blockly – Google’s visual programming editor. Blockly is used by millions of people to help them learn how to code in Hour of Code educational events all over the world. And now you can learn how to use it in Gamefroot! Let’s start with the basics.
The Script Editor allows you to give instructions to anything in your game. Those instructions are called a Script – just like how an actor is given a script in a movie to tell them what to do. Click Script Edit Mode in the top-right corner to open the Script Editor.
To create a script in the Script Editor, you simply connect blocks together like pieces of a jigsaw puzzle, and each block will give different instructions to an object in your game.
There are many, many different kinds of blocks you can use. To find the blocks that you want to use, click on the tabs in the sidebar on the left. The blocks are grouped according to what they do in the game, for example: all the blocks that deal with sound are in the Sound tab. To get a block out of the sidebar and into your workspace, drag the block over and release it.
Scripts will only work in your game if the blocks are properly connected together. To snap blocks together, drag them close to each other until they glow.
The blocks must also start with an event block. An event block triggers everything inside it to activate. Without an event block, your code wouldn’t know when it’s supposed to start working.
This collection of instruction blocks is saved as a script, and that script is then attached to an object in your game. You can combine many blocks together to create complex scripts that can do all kinds of amazing things, or you can create code as simple as “Hello world!”. Click here to start making some easy code with the Script Editor.
Once you’ve finished making your script, you can save it and close the Script Editor to return to the Level Editor. Your script will appear in the Scripts sidebar to the left, where you can then apply your script to an object in your game by selecting the script and then clicking on the object in your level.
Your scripts will run when you play your game – you can preview this by clicking the green Preview button in the top-right corner.
The best way to make a great script is to build it, test it in your game, then go back and edit the script to improve it. You can edit a script by clicking the Edit button on the script in the Scripts sidebar.
To learn how to easily make your first script, click here.
2 Replies to “The New Gamefroot Script Editor – Powered by Google Blockly!”