-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathcustomBlocks.js
More file actions
executable file
·59 lines (51 loc) · 1.6 KB
/
Copy pathcustomBlocks.js
File metadata and controls
executable file
·59 lines (51 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
goog.require('Blockly.Blocks');
/************************
* BLOCKLY DEFINITIONS *
*************************/
Blockly.Blocks['whenrunclicked'] = {
init: function() {
this.appendDummyInput()
.appendField("When RUN is clicked");
this.setNextStatement(true, null);
this.setColour(65);
this.setTooltip("");
this.setHelpUrl("");
}
};
Blockly.Blocks['clearscreen'] = {
init: function() {
this.appendDummyInput()
.appendField("Clear Canvas");
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(175);
this.setTooltip("");
this.setHelpUrl("");
}
};
Blockly.Blocks['catpose'] = {
init: function() {
this.appendDummyInput()
.appendField("Change Pose")
.appendField(new Blockly.FieldDropdown([["1","1"], ["2","2"], ["3","3"]]), "catIndex");
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(175);
this.setTooltip("");
this.setHelpUrl("");
}
};
Blockly.JavaScript['whenrunclicked'] = function(block) {
var statements_name = Blockly.JavaScript.statementToCode(block, 'NAME');
var blockCode = statements_name;
return blockCode;
};
Blockly.JavaScript['clearscreen'] = function(block) {
var blockCode = 'clearCanvas();';
return blockCode;
};
Blockly.JavaScript['catpose'] = function(block) {
var dropdown_catindex = block.getFieldValue('catIndex');
var blockCode = 'updatePose('+dropdown_catindex+');';
return blockCode;
};