@@ -12,23 +12,23 @@ export default function (Generator) {
12
12
Generator . wedo2_motorOnFor = function ( block ) {
13
13
const motorId = Generator . valueToCode ( block , 'MOTOR_ID' , Generator . ORDER_NONE ) || null ;
14
14
const duration = Generator . valueToCode ( block , 'DURATION' , Generator . ORDER_NONE ) || null ;
15
- return `wedo2_turn_motor_on_for (${ motorId } , ${ duration } )\n` ;
15
+ return `wedo2.turn_on_for (${ motorId } , ${ duration } )\n` ;
16
16
} ;
17
17
18
18
Generator . wedo2_motorOn = function ( block ) {
19
19
const motorId = Generator . valueToCode ( block , 'MOTOR_ID' , Generator . ORDER_NONE ) || null ;
20
- return `wedo2_trun_motor_on (${ motorId } )\n` ;
20
+ return `wedo2.turn_on (${ motorId } )\n` ;
21
21
} ;
22
22
23
23
Generator . wedo2_motorOff = function ( block ) {
24
24
const motorId = Generator . valueToCode ( block , 'MOTOR_ID' , Generator . ORDER_NONE ) || null ;
25
- return `wedo2_trun_motor_off (${ motorId } )\n` ;
25
+ return `wedo2.turn_off (${ motorId } )\n` ;
26
26
} ;
27
27
28
28
Generator . wedo2_startMotorPower = function ( block ) {
29
29
const motorId = Generator . valueToCode ( block , 'MOTOR_ID' , Generator . ORDER_NONE ) || null ;
30
30
const power = Generator . valueToCode ( block , 'POWER' , Generator . ORDER_NONE ) || null ;
31
- return `wedo2_set_motor_power (${ motorId } , ${ power } )\n` ;
31
+ return `wedo2.set_power (${ motorId } , ${ power } )\n` ;
32
32
} ;
33
33
34
34
Generator . wedo2_menu_MOTOR_DIRECTION = function ( block ) {
@@ -39,12 +39,12 @@ export default function (Generator) {
39
39
Generator . wedo2_setMotorDirection = function ( block ) {
40
40
const motorId = Generator . valueToCode ( block , 'MOTOR_ID' , Generator . ORDER_NONE ) || null ;
41
41
const motorDirection = Generator . valueToCode ( block , 'MOTOR_DIRECTION' , Generator . ORDER_NONE ) || null ;
42
- return `wedo2_set_motor_direction (${ motorId } , ${ motorDirection } )\n` ;
42
+ return `wedo2.set_direction (${ motorId } , ${ motorDirection } )\n` ;
43
43
} ;
44
44
45
45
Generator . wedo2_setLightHue = function ( block ) {
46
46
const hue = Generator . valueToCode ( block , 'HUE' , Generator . ORDER_NONE ) || null ;
47
- return `wedo2_set_light_color( ${ hue } ) \n` ;
47
+ return `wedo2.light_color = ${ hue } \n` ;
48
48
} ;
49
49
50
50
Generator . wedo2_menu_OP = function ( block ) {
@@ -56,7 +56,7 @@ export default function (Generator) {
56
56
block . isStatement = true ;
57
57
const op = Generator . valueToCode ( block , 'OP' , Generator . ORDER_NONE ) || null ;
58
58
const reference = Generator . valueToCode ( block , 'REFERENCE' , Generator . ORDER_NONE ) || null ;
59
- return `${ Generator . spriteName ( ) } .when(:wedo2_distance, ${ op } , ${ reference } ) do\n` ;
59
+ return `wedo2.when_distance( ${ op } , ${ reference } ) do\n` ;
60
60
} ;
61
61
62
62
Generator . wedo2_menu_TILT_DIRECTION_ANY = function ( block ) {
@@ -67,16 +67,16 @@ export default function (Generator) {
67
67
Generator . wedo2_whenTilted = function ( block ) {
68
68
block . isStatement = true ;
69
69
const tiltDirectionAny = Generator . valueToCode ( block , 'TILT_DIRECTION_ANY' , Generator . ORDER_NONE ) || null ;
70
- return `${ Generator . spriteName ( ) } .when(:wedo2_tilted, ${ tiltDirectionAny } ) do\n` ;
70
+ return `wedo2.when_tilted( ${ tiltDirectionAny } ) do\n` ;
71
71
} ;
72
72
73
73
Generator . wedo2_getDistance = function ( ) {
74
- return [ `wedo2_distance ` , Generator . ORDER_ATOMIC ] ;
74
+ return [ `wedo2.distance ` , Generator . ORDER_ATOMIC ] ;
75
75
} ;
76
76
77
77
Generator . wedo2_isTilted = function ( block ) {
78
78
const tiltDirectionAny = Generator . valueToCode ( block , 'TILT_DIRECTION_ANY' , Generator . ORDER_NONE ) || null ;
79
- return `wedo2_tilted (${ tiltDirectionAny } )\n` ;
79
+ return `wedo2.tilted? (${ tiltDirectionAny } )\n` ;
80
80
} ;
81
81
82
82
Generator . wedo2_menu_TILT_DIRECTION = function ( block ) {
@@ -86,7 +86,7 @@ export default function (Generator) {
86
86
87
87
Generator . wedo2_getTiltAngle = function ( block ) {
88
88
const tiltDirection = Generator . valueToCode ( block , 'TILT_DIRECTION' , Generator . ORDER_NONE ) || null ;
89
- return [ `wedo2_tilt_angle (${ tiltDirection } )` , Generator . ORDER_ATOMIC ] ;
89
+ return [ `wedo2.tilt_angle (${ tiltDirection } )` , Generator . ORDER_ATOMIC ] ;
90
90
} ;
91
91
92
92
return Generator ;
0 commit comments