Skip to content

Commit aa5b3e1

Browse files
committed
EV3のwhenDistanceLessThanを追加
1 parent de9cbcd commit aa5b3e1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/lib/ruby-generator/ev3.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,11 @@ export default function (Generator) {
4848
return `ev3_motor_position(${port})\n`;
4949
};
5050

51+
Generator.ev3_whenDistanceLessThan = function (block) {
52+
block.isStatement = true;
53+
const distance = Generator.valueToCode(block, 'DISTANCE', Generator.ORDER_NONE) || null;
54+
return `${Generator.spriteName()}.when(:ev3_distance_<, ${distance}) do\n`;
55+
};
56+
5157
return Generator;
5258
}

0 commit comments

Comments
 (0)