|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
goog.provide('Blockly.Blocks.extensions');
|
|
|
|
|
|
goog.require('Blockly.Blocks');
|
|
|
goog.require('Blockly.Colours');
|
|
|
goog.require('Blockly.constants');
|
|
|
goog.require('Blockly.ScratchBlocks.VerticalExtensions');
|
|
|
|
|
|
Blockly.Blocks['extension_pen_down'] = {
|
|
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
|
this.jsonInit({
|
|
|
"message0": "%1 %2 pen down",
|
|
|
"args0": [
|
|
|
{
|
|
|
"type": "field_image",
|
|
|
"src": Blockly.mainWorkspace.options.pathToMedia + "extensions/pen-block-icon.svg",
|
|
|
"width": 40,
|
|
|
"height": 40
|
|
|
},
|
|
|
{
|
|
|
"type": "field_vertical_separator"
|
|
|
}
|
|
|
],
|
|
|
"category": Blockly.Categories.more,
|
|
|
"extensions": ["colours_more", "shape_statement", "scratch_extension"]
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
Blockly.Blocks['extension_music_drum'] = {
|
|
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
|
this.jsonInit({
|
|
|
"message0": "%1 %2 play drum %3",
|
|
|
"args0": [
|
|
|
{
|
|
|
"type": "field_image",
|
|
|
"src": Blockly.mainWorkspace.options.pathToMedia + "extensions/music-block-icon.svg",
|
|
|
"width": 40,
|
|
|
"height": 40
|
|
|
},
|
|
|
{
|
|
|
"type": "field_vertical_separator"
|
|
|
},
|
|
|
{
|
|
|
"type": "input_value",
|
|
|
"name": "NUMBER"
|
|
|
}
|
|
|
],
|
|
|
"category": Blockly.Categories.more,
|
|
|
"extensions": ["colours_more", "shape_statement", "scratch_extension"]
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
Blockly.Blocks['extension_wedo_motor'] = {
|
|
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
|
this.jsonInit({
|
|
|
"message0": "%1 %2 turn a motor %3",
|
|
|
"args0": [
|
|
|
{
|
|
|
"type": "field_image",
|
|
|
"src": Blockly.mainWorkspace.options.pathToMedia + "extensions/wedo2-block-icon.svg",
|
|
|
"width": 40,
|
|
|
"height": 40
|
|
|
},
|
|
|
{
|
|
|
"type": "field_vertical_separator"
|
|
|
},
|
|
|
{
|
|
|
"type": "field_image",
|
|
|
"src": Blockly.mainWorkspace.options.pathToMedia + "rotate-right.svg",
|
|
|
"width": 24,
|
|
|
"height": 24
|
|
|
}
|
|
|
],
|
|
|
"category": Blockly.Categories.more,
|
|
|
"extensions": ["colours_more", "shape_statement", "scratch_extension"]
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
Blockly.Blocks['extension_wedo_hat'] = {
|
|
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
|
this.jsonInit({
|
|
|
"message0": "%1 %2 when I am wearing a hat",
|
|
|
"args0": [
|
|
|
{
|
|
|
"type": "field_image",
|
|
|
"src": Blockly.mainWorkspace.options.pathToMedia + "extensions/wedo2-block-icon.svg",
|
|
|
"width": 40,
|
|
|
"height": 40
|
|
|
},
|
|
|
{
|
|
|
"type": "field_vertical_separator"
|
|
|
}
|
|
|
],
|
|
|
"category": Blockly.Categories.more,
|
|
|
"extensions": ["colours_more", "shape_hat", "scratch_extension"]
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
Blockly.Blocks['extension_wedo_boolean'] = {
|
|
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
|
this.jsonInit({
|
|
|
"message0": "%1 %2 O RLY?",
|
|
|
"args0": [
|
|
|
{
|
|
|
"type": "field_image",
|
|
|
"src": Blockly.mainWorkspace.options.pathToMedia + "extensions/wedo2-block-icon.svg",
|
|
|
"width": 40,
|
|
|
"height": 40
|
|
|
},
|
|
|
{
|
|
|
"type": "field_vertical_separator"
|
|
|
}
|
|
|
],
|
|
|
"category": Blockly.Categories.more,
|
|
|
"extensions": ["colours_more", "output_boolean", "scratch_extension"]
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
Blockly.Blocks['extension_wedo_tilt_reporter'] = {
|
|
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
|
this.jsonInit({
|
|
|
"message0": "%1 %2 tilt angle %3",
|
|
|
"args0": [
|
|
|
{
|
|
|
"type": "field_image",
|
|
|
"src": Blockly.mainWorkspace.options.pathToMedia + "extensions/wedo2-block-icon.svg",
|
|
|
"width": 40,
|
|
|
"height": 40
|
|
|
},
|
|
|
{
|
|
|
"type": "field_vertical_separator"
|
|
|
},
|
|
|
{
|
|
|
"type": "input_value",
|
|
|
"name": "TILT"
|
|
|
}
|
|
|
],
|
|
|
"category": Blockly.Categories.more,
|
|
|
"extensions": ["colours_more", "output_number", "scratch_extension"]
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
Blockly.Blocks['extension_wedo_tilt_menu'] = {
|
|
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
|
this.jsonInit({
|
|
|
"message0": "%1",
|
|
|
"args0": [
|
|
|
{
|
|
|
"type": "field_dropdown",
|
|
|
"name": "TILT",
|
|
|
"options": [
|
|
|
['Any', 'Any'],
|
|
|
['Whirl', 'Whirl'],
|
|
|
['South', 'South'],
|
|
|
['Back in time', 'Back in time']
|
|
|
]
|
|
|
}
|
|
|
],
|
|
|
"extensions": ["colours_more", "output_string"]
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
Blockly.Blocks['extension_music_reporter'] = {
|
|
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
|
this.jsonInit({
|
|
|
"message0": "%1 %2 hey now, you're an all-star",
|
|
|
"args0": [
|
|
|
{
|
|
|
"type": "field_image",
|
|
|
"src": Blockly.mainWorkspace.options.pathToMedia + "extensions/music-block-icon.svg",
|
|
|
"width": 40,
|
|
|
"height": 40
|
|
|
},
|
|
|
{
|
|
|
"type": "field_vertical_separator"
|
|
|
}
|
|
|
],
|
|
|
"category": Blockly.Categories.more,
|
|
|
"extensions": ["colours_more", "output_number", "scratch_extension"]
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
Blockly.Blocks['extension_microbit_display'] = {
|
|
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
|
this.jsonInit({
|
|
|
"message0": "%1 %2 display %3",
|
|
|
"args0": [
|
|
|
{
|
|
|
"type": "field_image",
|
|
|
"src": Blockly.mainWorkspace.options.pathToMedia + "extensions/microbit-block-icon.svg",
|
|
|
"width": 40,
|
|
|
"height": 40
|
|
|
},
|
|
|
{
|
|
|
"type": "field_vertical_separator"
|
|
|
},
|
|
|
{
|
|
|
"type": "input_value",
|
|
|
"name": "MATRIX"
|
|
|
},
|
|
|
],
|
|
|
"category": Blockly.Categories.pen,
|
|
|
"extensions": ["colours_pen", "shape_statement", "scratch_extension"]
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
Blockly.Blocks['extension_music_play_note'] = {
|
|
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
|
this.jsonInit({
|
|
|
"message0": "%1 %2 play note %3 for %4 beats",
|
|
|
"args0": [
|
|
|
{
|
|
|
"type": "field_image",
|
|
|
"src": Blockly.mainWorkspace.options.pathToMedia + "extensions/music-block-icon.svg",
|
|
|
"width": 40,
|
|
|
"height": 40
|
|
|
},
|
|
|
{
|
|
|
"type": "field_vertical_separator"
|
|
|
},
|
|
|
{
|
|
|
"type": "input_value",
|
|
|
"name": "NOTE"
|
|
|
},
|
|
|
{
|
|
|
"type": "input_value",
|
|
|
"name": "BEATS"
|
|
|
}
|
|
|
],
|
|
|
"category": Blockly.Categories.pen,
|
|
|
"extensions": ["colours_pen", "shape_statement", "scratch_extension"]
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|