Code Snippets

CoSpaces has a visual coding language based on JavaScript called CoBlocks. These are segments of code that can be linked together to write the script, without the need to type out the code. Below are examples of how we will use CoBlocks to code our different scenes in class.

Basic “is clicked” Events

With “is hovered” Events

“Say” and “Think” Blocks

Basic Challenge (“move” and “turn” blocks; Loops)

Advanced Challenge (Variables and Randomizing Values)

Multiple loops (“run parallel” block)

Verticle Moving Platform (“forever” Looped)

Multiple Moving Platforms (“run parallel” Block)

Using “if” Statments

“A to B” Win Condition

“Score” Win Condition

“Lock and Key” Win Condition