Skip to content

Commit 61d2923

Browse files
committed
[ADD] converter of microbit.tilted? function
1 parent fb1b184 commit 61d2923

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/lib/ruby-to-blocks-converter/microbit.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,18 @@ const MicroBitConverter = {
8585
delete receiver.inputs.EXPRESSION;
8686
}
8787
break;
88+
case 'tilted?':
89+
if (args.length === 1 && this._isString(args[0])) {
90+
block = this._changeBlock(receiver, 'microbit_isTilted', 'value_boolean');
91+
delete this._context.blocks[receiver.inputs.EXPRESSION.block];
92+
delete receiver.inputs.EXPRESSION;
93+
94+
this._addFieldInput(
95+
block, 'DIRECTION', 'microbit_menu_tiltDirectionAny', 'tiltDirectionAny',
96+
args[0], 'any'
97+
)
98+
}
99+
break;
88100
}
89101
}
90102
return block;

0 commit comments

Comments
 (0)