Skip to content
This repository was archived by the owner on Feb 14, 2025. It is now read-only.

Latest commit

 

History

History
38 lines (28 loc) · 1.12 KB

File metadata and controls

38 lines (28 loc) · 1.12 KB

Case: let users create own 'actions', they can use/save in their IDE

Toolbox updates

Blockly allows for toolbox updates while still in use

workspace.updateToolbox(newTree)

where 'newTree' is either a tree of nodes, or a string representation of the toolbox.

-> This could also be helpful with the eventHandler- and main game block, where we only want on block each.

Events

Blockly allows for custom events which could be helpful e.g. for 'achievements' or maximum block sizes

function onFirstComment(event) {
  if (event.type == Blockly.Events.CHANGE &&
      event.element == 'comment' &&
      !event.oldValue && event.newValue) {
    alert('Congratulations on creating your first comment!')
    workspace.removeChangeListener(onFirstComment);
  }
}
workspace.addChangeListener(onFirstComment);a

Advanced Blocks

It is also possible to save nested blocks with more advanced logic blockly_nested


-> Features combined could let users create their 'own' blocks with advanced behaviour which could then be saved and reused late.