1+ Blockly . Blocks [ 'wabot_new' ] = {
2+ init : function ( ) {
3+ this . appendDummyInput ( )
4+ . appendField ( Blockly . Msg . WEBDUINO_WABOT , "瓦寶機器人" ) ;
5+ this . setOutput ( true ) ;
6+ this . setColour ( 230 ) ;
7+ this . setTooltip ( '' ) ;
8+ this . setHelpUrl ( 'https://webduino.io' ) ;
9+ }
10+ } ;
11+
12+
13+ Blockly . Blocks [ 'wabot_step' ] = {
14+ init : function ( ) {
15+ this . appendValueInput ( "step" )
16+ . setCheck ( "Number" )
17+ . appendField ( new Blockly . FieldVariable ( "wabot" ) , "wabot" )
18+ . appendField ( "動作" )
19+ . appendField ( new Blockly . FieldDropdown (
20+ [
21+ [ "往前走" , "walk" ] ,
22+ [ "跑步" , "run" ]
23+ ] ) , "step" ) ;
24+ this . setPreviousStatement ( true , null ) ;
25+ this . setNextStatement ( true , null ) ;
26+ this . setColour ( 65 ) ;
27+ this . setTooltip ( '' ) ;
28+ this . setHelpUrl ( 'https://webduino.io' ) ;
29+ }
30+ } ;
31+
32+
33+
34+ Blockly . Blocks [ 'wabot_backyard' ] = {
35+ init : function ( ) {
36+ this . appendValueInput ( "step" )
37+ . setCheck ( "Number" )
38+ . appendField ( new Blockly . FieldVariable ( "wabot" ) , "wabot" )
39+ . appendField ( "動作" )
40+ . appendField ( new Blockly . FieldDropdown (
41+ [
42+ [ "向後轉" , "backyard" ] ,
43+ [ "慢慢向後轉" , "backyardSlow" ]
44+ ] ) , "step" ) ;
45+ this . setPreviousStatement ( true , null ) ;
46+ this . setNextStatement ( true , null ) ;
47+ this . setColour ( 65 ) ;
48+ this . setTooltip ( '' ) ;
49+ this . setHelpUrl ( 'https://webduino.io' ) ;
50+ }
51+ } ;
52+
53+
54+
55+ Blockly . Blocks [ 'wabot_turn' ] = {
56+ init : function ( ) {
57+ this . appendValueInput ( "step" )
58+ . setCheck ( "Number" )
59+ . appendField ( new Blockly . FieldVariable ( "wabot" ) , "wabot" )
60+ . appendField ( "動作" )
61+ . appendField ( new Blockly . FieldDropdown (
62+ [
63+ [ "向左轉" , "turnLeft" ] ,
64+ [ "向右轉" , "turnRight" ]
65+ ] ) , "step" ) ;
66+ this . setPreviousStatement ( true , null ) ;
67+ this . setNextStatement ( true , null ) ;
68+ this . setColour ( 65 ) ;
69+ this . setTooltip ( '' ) ;
70+ this . setHelpUrl ( 'https://webduino.io' ) ;
71+ }
72+ } ;
73+
74+
75+
76+ Blockly . Blocks [ 'wabot_action' ] = {
77+ init : function ( ) {
78+ this . appendValueInput ( "step" )
79+ . setCheck ( "Number" )
80+ . appendField ( new Blockly . FieldVariable ( "wabot" ) , "wabot" )
81+ . appendField ( "動作" )
82+ . appendField ( new Blockly . FieldDropdown (
83+ [
84+ [ "立正" , "standard" ] ,
85+ [ "墊腳尖" , "goingUp" ] ,
86+ [ "踢左腳" , "kickLeft" ] ,
87+ [ "踢右腳" , "kickRight" ] ,
88+ [ "向左月球漫步" , "moonWalkLeft" ] ,
89+ [ "向右月球漫步" , "moonWalkRight" ] ,
90+ [ "玻璃舞" , "crusaito" ] ,
91+ [ "裝可愛" , "swing" ] ,
92+ [ "上下跳動" , "upDown" ] ,
93+ [ "快樂向前" , "flapping" ]
94+ ] ) , "step" ) ;
95+ this . setPreviousStatement ( true , null ) ;
96+ this . setNextStatement ( true , null ) ;
97+ this . setColour ( 65 ) ;
98+ this . setTooltip ( '' ) ;
99+ this . setHelpUrl ( 'https://webduino.io' ) ;
100+ }
101+ } ;
102+
103+
104+
105+ Blockly . Blocks [ 'wabot_tempo' ] = {
106+ init : function ( ) {
107+ this . appendValueInput ( "step" )
108+ . setCheck ( "Number" )
109+ . appendField ( new Blockly . FieldVariable ( "wabot" ) , "wabot" )
110+ . appendField ( "動作" )
111+ . appendField ( new Blockly . FieldDropdown (
112+ [
113+ [ "跳舞" , "dance" ] ,
114+ [ "酒醉" , "drunk" ] ,
115+ [ "跌倒" , "noGravity" ] ,
116+ ] ) , "step" ) ;
117+ this . setPreviousStatement ( true , null ) ;
118+ this . setNextStatement ( true , null ) ;
119+ this . setColour ( 65 ) ;
120+ this . setTooltip ( '' ) ;
121+ this . setHelpUrl ( 'https://webduino.io' ) ;
122+ }
123+ } ;
124+
125+
126+
127+ Blockly . Blocks [ 'wabot_walk' ] = {
128+ init : function ( ) {
129+ this . appendValueInput ( "step" )
130+ . setCheck ( "Number" )
131+ . appendField ( new Blockly . FieldVariable ( "wabot" ) , "wabot" )
132+ . appendField ( Blockly . Msg . WEBDUINO_WABOT_WALK ) ;
133+ this . setInputsInline ( false ) ;
134+ this . setPreviousStatement ( true , null ) ;
135+ this . setNextStatement ( true , null ) ;
136+ this . setColour ( 65 ) ;
137+ this . setTooltip ( '' ) ;
138+ }
139+ } ;
0 commit comments