-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerators.ts
More file actions
28 lines (24 loc) · 1.16 KB
/
generators.ts
File metadata and controls
28 lines (24 loc) · 1.16 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
Blockly.Python['import_movemini'] = function(block) {
var code = 'from movemini import *\n';
return code;
};
Blockly.Python['movemini_init'] = function(block) {
var variable_robot = Blockly.Python.variableDB_.getName(block.getFieldValue('robot'), Blockly.Variables.NAME_TYPE);
// TODO: Assemble Python into code variable.
var code = variable_robot + ' = MoveMini()\n';
return code;
};
Blockly.Python['movemini_direction'] = function(block) {
var variable_robot = Blockly.Python.variableDB_.getName(block.getFieldValue('robot'), Blockly.Variables.NAME_TYPE);
var dropdown_directions = block.getFieldValue('directions');
var value_name = Blockly.Python.valueToCode(block, 'NAME', Blockly.Python.ORDER_ATOMIC);
// TODO: Assemble Python into code variable.
var code = variable_robot+ '.' +dropdown_directions+ '(' +value_name+ ')\n';
return code;
};
Blockly.Python['movemini_stop'] = function(block) {
var variable_robot = Blockly.Python.variableDB_.getName(block.getFieldValue('robot'), Blockly.Variables.NAME_TYPE);
// TODO: Assemble Python into code variable.
var code = variable_robot+ '.stop()\n';
return code;
};