{
opcode: 'onCustomEvent',
blockType: Scratch.BlockType.HAT,
event: 'customEvent',
text: 'when a custom event is fired'
},
{
// demo block just to show that you can fire the event from within the extension
opcode: 'fireCustomEvent',
blockType: Scratch.BlockType.COMMAND
}
...
fireCustomEvent() {
Scratch.vm.runtime.emit('customEvent');
}
and to be clear i am not saying it must be done this way, only that it would be nice if you could use actual events for hat blocks
the ability to point to an event name instead of requiring a function to return true or false if a event has happend basicaly
instead of
and for custom events its the exact same
and to be clear i am not saying it must be done this way, only that it would be nice if you could use actual events for hat blocks