[j2code]
NEW
LOAD
SAVE
*
LINK
PUBLISH
EXAMPLES
HELP
ABOUT
level 1
2
3
turtle
ARC length angle
CIRCLE radius
CLEARTEXT
HIDETURTLE
PENWIDTH width
PRINT [ . ]
RESET
SETHEADING angle
SETX x
SETXY x y
SETY y
SHOWTURTLE
maths
ARCTAN number
COS angle
INT number
RANDOM number
ROUND number
SIN angle
SQRT number
lists
BUTFIRST list
BUTLAST list
FIRST list
FPUT thing list
ITEM index thing
LAST list
LPUT thing list
SETITEM index array value
Level 1 - buttons act on turtle, and show in the command area.
<xml id="visual" speed="3" grid="false" style="display:none;"><sprite id='nTXwoud5N5CgSVjp' name='BG Track' x='0' y='0' homex='0' homey='0' direction='0' pendown='false' visible='true' opacity='100' costume='0' level='2'><costume uuid="TBfLLyOrIFkGE1gs" id="nNYHVhdAJhpA8qKi" name="race track" width="500" height="500" background="true"/><blockly><xml xmlns="http://www.w3.org/1999/xhtml"></xml><js></js></blockly></sprite><sprite id='HknKaQ8dsTax4mwk' name='Yellow Car' x='-214' y='-29' homex='-214' homey='-29' direction='0' pendown='false' visible='true' opacity='100' costume='0' level='2'><costume uuid="YyQ8S5iPMr3gut2n" id="9vDR9qgg5WhxejoK" name="yellow car" width="30" height="30" flippedHor="true"/><blockly><xml xmlns="http://www.w3.org/1999/xhtml"><block type="events_keypressed" id="1" x="336" y="20"><field name="KEY">space bar</field><statement name="DO"><block type="controls_forever" id="2"><statement name="DO"><block type="draw_move" id="3" inline="false"><field name="DIR">moveForward</field><value name="VALUE"><block type="math_number" id="4"><field name="NUM">10</field></block></value></block></statement></block></statement></block><block type="events_arrowkeypressed" id="5" x="123" y="99"><field name="KEY">left</field><statement name="DO"><block type="draw_turn" id="6" inline="false"><field name="DIR">turnLeft</field><value name="VALUE"><block type="math_number" id="7"><field name="NUM">15</field></block></value></block></statement></block><block type="events_arrowkeypressed" id="8" x="537" y="90"><field name="KEY">right</field><statement name="DO"><block type="draw_turn" id="9" inline="false"><field name="DIR">turnRight</field><value name="VALUE"><block type="math_number" id="10"><field name="NUM">15</field></block></value></block></statement></block><block type="controls_repeat" id="11" x="390" y="248"><field name="TIMES">1</field><statement name="DO"><block type="draw_sayingWait" id="12" inline="true"><field name="SECS">5</field><value name="TEXT"><block type="text" id="13"><field name="TEXT">Red car uses keys "A" and "D" to turn left and right.</field></block></value><next><block type="draw_sayingWait" id="14" inline="true"><field name="SECS">5</field><value name="TEXT"><block type="text" id="15"><field name="TEXT">Yellow car uses left arrow and right arrow keys to turn left and right.</field></block></value><next><block type="controls_waitSeconds" id="16" inline="true"><value name="SECS"><block type="math_number" id="17"><field name="NUM">1</field></block></value><next><block type="draw_sayingWait" id="18" inline="true"><field name="SECS">1</field><value name="TEXT"><block type="text" id="19"><field name="TEXT">When ready, press SPACE BAR to start the race!</field></block></value></block></next></block></next></block></next></block></statement></block><block type="events_keypressed" id="20" x="359" y="474"><field name="KEY">space bar</field><statement name="DO"><block type="draw_sayingWait" id="21" inline="true"><field name="SECS">1</field><value name="TEXT"><block type="text" id="22"><field name="TEXT">when you want to stop press space bar</field></block></value></block></statement></block></xml><js><![CDATA[var sprite = Sprites[1];\n\n\nsprite.keyPressed('space bar', function(){\n while (visual.evaluateWhileCondition(function(){ return true; }, sprite, '2')) {\n sprite.moveForward(function(){return 10;}, 'block_id_3');\n visual.gotoEvaluateWhileCondition('2');\n }\n}\n, 'block_id_1');\n\nsprite.keyPressed('left', function(){\n sprite.turnLeft(function(){return (15)*-1;}, 'block_id_6');\n}\n, 'block_id_5');\n\nsprite.keyPressed('right', function(){\n sprite.turnRight(function(){return 15;}, 'block_id_9');\n}\n, 'block_id_8');\n\nsprite.keyPressed('space bar', function(){\n sprite.drawSayingWait(function(){return 'when you want to stop press space bar';}, 1, 'block_id_21');\n}\n, 'block_id_20');\n\nfor (var count = 0; count < 1; count++) {\n BlocklyApps.checkTimeout('11');\n sprite.drawSayingWait(function(){return 'Red car uses keys "A" and "D" to turn left and right.';}, 5, 'block_id_12');\n sprite.drawSayingWait(function(){return 'Yellow car uses left arrow and right arrow keys to turn left and right.';}, 5, 'block_id_14');\n sprite.waitSeconds(1, 'block_id_16');\n sprite.drawSayingWait(function(){return 'When ready, press SPACE BAR to start the race!';}, 1, 'block_id_18');\n}\n]]></js></blockly></sprite><sprite id='6MBn3URGA7EFW2tD' name='Red Car' x='-193' y='-29' homex='-193' homey='-29' direction='0' pendown='false' visible='true' opacity='100' costume='1' level='2'><costume uuid="wpIV5BFiMtaqej46" id="9vDR9qgg5WhxejoK" name="yellow car" width="30" height="30"/><costume uuid="igwuXALs4f9JqhTc" id="Si4CrU3gozc1SRFI" name="red car" width="30" height="30"/><blockly><xml xmlns="http://www.w3.org/1999/xhtml"><block type="events_keypressed" id="1" x="198" y="36"><field name="KEY">space bar</field><statement name="DO"><block type="controls_forever" id="2"><statement name="DO"><block type="draw_move" id="3" inline="false"><field name="DIR">moveForward</field><value name="VALUE"><block type="math_number" id="4"><field name="NUM">10</field></block></value></block></statement></block></statement></block><block type="events_arrowkeypressed" id="5" x="69" y="151"><field name="KEY">left</field><statement name="DO"><block type="draw_turn" id="6" inline="false"><field name="DIR">turnLeft</field><value name="VALUE"><block type="math_number" id="7"><field name="NUM">15</field></block></value></block></statement></block><block type="events_arrowkeypressed" id="8" x="418" y="160"><field name="KEY">right</field><statement name="DO"><block type="draw_turn" id="9" inline="false"><field name="DIR">turnRight</field><value name="VALUE"><block type="math_number" id="10"><field name="NUM">10</field></block></value></block></statement></block></xml><js><![CDATA[var sprite = Sprites[2];\n\n\nsprite.keyPressed('space bar', function(){\n while (visual.evaluateWhileCondition(function(){ return true; }, sprite, '2')) {\n sprite.moveForward(function(){return 10;}, 'block_id_3');\n visual.gotoEvaluateWhileCondition('2');\n }\n}\n, 'block_id_1');\n\nsprite.keyPressed('left', function(){\n sprite.turnLeft(function(){return (15)*-1;}, 'block_id_6');\n}\n, 'block_id_5');\n\nsprite.keyPressed('right', function(){\n sprite.turnRight(function(){return 10;}, 'block_id_9');\n}\n, 'block_id_8');\n]]></js></blockly></sprite></xml>
Your browser doesn't support canvas tags.
Notifications
Mark all as read
unread
x
j2message
x
j2stars
x
j2homework
x
myfiles
x
j2journal
x
Loading...