11Blockly . Blocks [ 'wabot_new' ] = {
22 init : function ( ) {
33 this . appendDummyInput ( )
4- . appendField ( Blockly . Msg . WEBDUINO_WABOT , "瓦寶機器人 " ) ;
4+ . appendField ( Blockly . Msg . WEBDUINO_WABOT , "哇寶機器人 " ) ;
55 this . setOutput ( true ) ;
66 this . setColour ( 230 ) ;
77 this . setTooltip ( '' ) ;
88 this . setHelpUrl ( 'https://webduino.io' ) ;
99 }
1010} ;
1111
12-
13- Blockly . Blocks [ 'wabot_servo' ] = {
12+ Blockly . Blocks [ 'wabot_basic_action' ] = {
1413 init : function ( ) {
15- this . appendValueInput ( "servo" )
16- . setCheck ( null )
17- . appendField ( new Blockly . FieldVariable ( "wabot" ) , "wabot" )
18- . appendField ( "設定" )
19- . appendField ( new Blockly . FieldDropdown ( [
20- [ "右足" , "0" ] ,
21- [ "左足" , "1" ] ,
22- [ "右腿" , "2" ] ,
23- [ "左腿" , "3" ] ,
24- [ "左手" , "4" ] ,
25- [ "右手" , "5" ]
26- ] ) , "n" ) ;
14+ this . appendDummyInput ( )
15+ . appendField ( new Blockly . FieldVariable ( "wabot" ) , "wabot" )
16+ . appendField ( "動作" )
17+ . appendField ( new Blockly . FieldDropdown (
18+ [
19+ [ "向前走" , "walk" ] ,
20+ [ "向後走" , "goBack" ] ,
21+ [ "向左走" , "moonWalkLeft" ] ,
22+ [ "向右走" , "moonWalkRight" ] ,
23+ [ "向左轉" , "turnLeft" ] ,
24+ [ "向右轉" , "turnRight" ] ,
25+ [ "向後轉" , "backyard" ]
26+ ] ) , "action" )
2727 this . setPreviousStatement ( true , null ) ;
2828 this . setNextStatement ( true , null ) ;
2929 this . setColour ( 65 ) ;
@@ -32,18 +32,19 @@ Blockly.Blocks['wabot_servo'] = {
3232 }
3333} ;
3434
35-
36- Blockly . Blocks [ 'wabot_step' ] = {
35+ Blockly . Blocks [ 'wabot_tempo' ] = {
3736 init : function ( ) {
38- this . appendValueInput ( "step" )
39- . setCheck ( "Number" )
37+ this . appendDummyInput ( )
4038 . appendField ( new Blockly . FieldVariable ( "wabot" ) , "wabot" )
4139 . appendField ( "動作" )
4240 . appendField ( new Blockly . FieldDropdown (
4341 [
44- [ "往前走" , "walk" ] ,
42+ [ "裝可愛" , "swing" ] ,
43+ // ["上下跳動", "upDown"],
44+ [ "快樂向前" , "flapping" ] ,
45+ [ "玻璃舞" , "crusaito" ] ,
4546 [ "跑步" , "run" ]
46- ] ) , "step " ) ;
47+ ] ) , "special " ) ;
4748 this . setPreviousStatement ( true , null ) ;
4849 this . setNextStatement ( true , null ) ;
4950 this . setColour ( 65 ) ;
@@ -52,19 +53,21 @@ Blockly.Blocks['wabot_step'] = {
5253 }
5354} ;
5455
55-
56-
57- Blockly . Blocks [ 'wabot_backyard' ] = {
56+ Blockly . Blocks [ 'wabot_status' ] = {
5857 init : function ( ) {
59- this . appendValueInput ( "step" )
60- . setCheck ( "Number" )
61- . appendField ( new Blockly . FieldVariable ( "wabot" ) , "wabot" )
62- . appendField ( "動作" )
63- . appendField ( new Blockly . FieldDropdown (
64- [
65- [ "向後轉" , "backyard" ] ,
66- [ "慢慢向後轉" , "backyardSlow" ]
67- ] ) , "step" ) ;
58+ this . appendDummyInput ( )
59+ . appendField ( new Blockly . FieldVariable ( "wabot" ) , "wabot" )
60+ . appendField ( "動作" )
61+ . appendField ( new Blockly . FieldDropdown (
62+ [
63+ [ "立正" , "standard" ] ,
64+ [ "踢左腳" , "kickLeft" ] ,
65+ [ "踢右腳" , "kickRight" ] ,
66+ // ["墊腳尖","goingUp"],
67+ [ "跌倒" , "noGravity" ] ,
68+ [ "酒醉" , "drunk" ] ,
69+ [ "跳舞" , "dance" ]
70+ ] ) , "status" ) ;
6871 this . setPreviousStatement ( true , null ) ;
6972 this . setNextStatement ( true , null ) ;
7073 this . setColour ( 65 ) ;
@@ -73,19 +76,22 @@ Blockly.Blocks['wabot_backyard'] = {
7376 }
7477} ;
7578
76-
77-
78- Blockly . Blocks [ 'wabot_turn' ] = {
79+ Blockly . Blocks [ 'wabot_angle' ] = {
7980 init : function ( ) {
80- this . appendValueInput ( "step" )
81- . setCheck ( "Number" )
82- . appendField ( new Blockly . FieldVariable ( "wabot" ) , "wabot" )
83- . appendField ( "動作" )
84- . appendField ( new Blockly . FieldDropdown (
85- [
86- [ "向左轉" , "turnLeft" ] ,
87- [ "向右轉" , "turnRight" ]
88- ] ) , "step" ) ;
81+ this . appendValueInput ( "angle" )
82+ . appendField ( new Blockly . FieldVariable ( "wabot" ) , "wabot" )
83+ . appendField ( "設定" )
84+ . appendField ( new Blockly . FieldDropdown (
85+ [
86+ [ "右足" , "0" ] ,
87+ [ "左足" , "1" ] ,
88+ [ "右腿" , "2" ] ,
89+ [ "左腿" , "3" ] ,
90+ [ "左手" , "4" ] ,
91+ [ "右手" , "5" ]
92+ ] ) , "limb" ) ;
93+ this . appendDummyInput ( )
94+ . appendField ( "度" ) ;
8995 this . setPreviousStatement ( true , null ) ;
9096 this . setNextStatement ( true , null ) ;
9197 this . setColour ( 65 ) ;
@@ -94,27 +100,22 @@ Blockly.Blocks['wabot_turn'] = {
94100 }
95101} ;
96102
97-
98-
99- Blockly . Blocks [ 'wabot_action' ] = {
103+ Blockly . Blocks [ 'wabot_angle_tool' ] = {
100104 init : function ( ) {
101- this . appendValueInput ( "step" )
102- . setCheck ( "Number" )
105+ this . appendDummyInput ( )
103106 . appendField ( new Blockly . FieldVariable ( "wabot" ) , "wabot" )
104- . appendField ( "動作 " )
107+ . appendField ( "設定 " )
105108 . appendField ( new Blockly . FieldDropdown (
106- [
107- [ "立正" , "standard" ] ,
108- [ "墊腳尖" , "goingUp" ] ,
109- [ "踢左腳" , "kickLeft" ] ,
110- [ "踢右腳" , "kickRight" ] ,
111- [ "向左月球漫步" , "moonWalkLeft" ] ,
112- [ "向右月球漫步" , "moonWalkRight" ] ,
113- [ "玻璃舞" , "crusaito" ] ,
114- [ "裝可愛" , "swing" ] ,
115- [ "上下跳動" , "upDown" ] ,
116- [ "快樂向前" , "flapping" ]
117- ] ) , "step" ) ;
109+ [
110+ [ "右足" , "0" ] ,
111+ [ "左足" , "1" ] ,
112+ [ "右腿" , "2" ] ,
113+ [ "左腿" , "3" ] ,
114+ [ "左手" , "4" ] ,
115+ [ "右手" , "5" ]
116+ ] ) , "limb" )
117+ . appendField ( "為" )
118+ . appendField ( new Blockly . FieldAngle ( 90 ) , "pos" ) ;
118119 this . setPreviousStatement ( true , null ) ;
119120 this . setNextStatement ( true , null ) ;
120121 this . setColour ( 65 ) ;
@@ -123,40 +124,16 @@ Blockly.Blocks['wabot_action'] = {
123124 }
124125} ;
125126
126-
127-
128- Blockly . Blocks [ 'wabot_tempo' ] = {
127+ Blockly . Blocks [ 'wabot_stop' ] = {
129128 init : function ( ) {
130- this . appendValueInput ( "step" )
131- . setCheck ( "Number" )
132- . appendField ( new Blockly . FieldVariable ( "wabot" ) , "wabot" )
133- . appendField ( "動作" )
134- . appendField ( new Blockly . FieldDropdown (
135- [
136- [ "跳舞" , "dance" ] ,
137- [ "酒醉" , "drunk" ] ,
138- [ "跌倒" , "noGravity" ] ,
139- ] ) , "step" ) ;
129+ this . appendDummyInput ( )
130+ . appendField ( new Blockly . FieldVariable ( "wabot" ) , "wabot" )
131+ . appendField ( "停止動作" ) ;
132+ this . setColour ( 65 ) ;
140133 this . setPreviousStatement ( true , null ) ;
141134 this . setNextStatement ( true , null ) ;
142- this . setColour ( 65 ) ;
143- this . setTooltip ( '' ) ;
135+ this . setTooltip ( "" ) ;
144136 this . setHelpUrl ( 'https://webduino.io' ) ;
145137 }
146- } ;
147-
148-
138+ } ;
149139
150- Blockly . Blocks [ 'wabot_walk' ] = {
151- init : function ( ) {
152- this . appendValueInput ( "step" )
153- . setCheck ( "Number" )
154- . appendField ( new Blockly . FieldVariable ( "wabot" ) , "wabot" )
155- . appendField ( Blockly . Msg . WEBDUINO_WABOT_WALK ) ;
156- this . setInputsInline ( false ) ;
157- this . setPreviousStatement ( true , null ) ;
158- this . setNextStatement ( true , null ) ;
159- this . setColour ( 65 ) ;
160- this . setTooltip ( '' ) ;
161- }
162- } ;
0 commit comments