File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import PenBlocks from './pen.js';
21
21
import VideoBlocks from './video.js' ;
22
22
import Text2SpeechBlocks from './text2speech.js' ;
23
23
import TranslateBlocks from './translate.js' ;
24
+ import MakeyMakeyBlocks from './makeymakey.js' ;
24
25
import MicrobitBlocks from './microbit.js' ;
25
26
26
27
const SCALAR_TYPE = '' ;
@@ -445,6 +446,7 @@ PenBlocks(RubyGenerator);
445
446
VideoBlocks ( RubyGenerator ) ;
446
447
Text2SpeechBlocks ( RubyGenerator ) ;
447
448
TranslateBlocks ( RubyGenerator ) ;
449
+ MakeyMakeyBlocks ( RubyGenerator ) ;
448
450
MicrobitBlocks ( RubyGenerator ) ;
449
451
450
452
export default RubyGenerator ;
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Define Ruby code generator for MakeyMakey Blocks
3
+ * @param {RubyGenerator } Generator The RubyGenerator
4
+ * @return {RubyGenerator } same as param.
5
+ */
6
+ export default function ( Generator ) {
7
+ Generator . makeymakey_menu_KEY = function ( block ) {
8
+ const key = Generator . quote_ ( Generator . getFieldValue ( block , 'KEY' ) || 'SPACE' ) ;
9
+ return [ key , Generator . ORDER_ATOMIC ] ;
10
+ } ;
11
+
12
+ Generator . makeymakey_whenMakeyKeyPressed = function ( block ) {
13
+ block . isStatement = true ;
14
+ const key = Generator . valueToCode ( block , 'KEY' , Generator . ORDER_NONE ) || null ;
15
+ return `${ Generator . spriteName ( ) } .when(:makey_key_pressed, ${ key } ) do\n` ;
16
+ } ;
17
+
18
+ return Generator ;
19
+ }
You can’t perform that action at this time.
0 commit comments