Spaces:
No application file
No application file
pseudo_code_examples = [ | |
# From motion_block.json | |
""" | |
when green flag clicked | |
go to x: (0) y: (0) | |
point in direction (90) | |
move (50) steps | |
end | |
""", | |
""" | |
when [right arrow v] key pressed | |
turn right (15) degrees | |
end | |
""", | |
""" | |
when this sprite clicked | |
go to [mouse-pointer v] | |
""", | |
""" | |
when green flag clicked | |
glide (2) secs to x: (150) y: (-100) | |
glide (2) secs to x: (-150) y: (100) | |
end | |
""", | |
""" | |
when green flag clicked | |
forever | |
point towards [mouse-pointer v] | |
move (5) steps | |
end | |
end | |
""", | |
""" | |
when [right arrow v] key pressed | |
change x by (10) | |
end | |
""", | |
""" | |
when green flag clicked | |
set x to (0) | |
set y to (0) | |
end | |
""", | |
""" | |
when [up arrow v] key pressed | |
change y by (10) | |
end | |
""", | |
""" | |
when green flag clicked | |
forever | |
move (10) steps | |
if on edge, bounce | |
end | |
end | |
""", | |
""" | |
when green flag clicked | |
set rotation style [left-right v] | |
forever | |
move (10) steps | |
if on edge, bounce | |
end | |
end | |
""", | |
# From looks_block.json | |
""" | |
when green flag clicked | |
say [Grr] for (3) seconds | |
say [Have you seen my honey? v] for (3) seconds | |
end | |
""", | |
""" | |
when green flag clicked | |
say [Welcome to my game! v] | |
wait (2) seconds | |
say [] | |
end | |
""", | |
""" | |
when this sprite clicked | |
think [What should I do? v] for (2) seconds | |
end | |
""", | |
""" | |
when I receive [correct answer v] | |
think [That's right! v] | |
wait (1) seconds | |
think [good v] | |
end | |
""", | |
""" | |
when I receive [explosion v] | |
repeat (5) | |
next costume | |
end | |
hide | |
end | |
""", | |
""" | |
when green flag clicked | |
forever | |
next costume | |
wait (0.2) seconds | |
end | |
end | |
""", | |
""" | |
when green flag clicked | |
switch backdrop to [start screen v] | |
end | |
""", | |
""" | |
broadcast [game over v] | |
switch backdrop to [game over v] and wait | |
stop [all v] | |
end | |
""", | |
""" | |
when [space v] key pressed | |
next backdrop | |
end | |
""", | |
""" | |
when green flag clicked | |
repeat (10) | |
change size by (5) | |
wait (0.1) seconds | |
end | |
end | |
""", | |
""" | |
when green flag clicked | |
set size to (50) % | |
wait (1) seconds | |
set size to (100) % | |
end | |
""", | |
""" | |
when green flag clicked | |
forever | |
change [color v] effect by (5) | |
wait (0.1) seconds | |
end | |
end | |
""", | |
""" | |
when green flag clicked | |
set [ghost v] effect to (75) | |
end | |
""", | |
""" | |
when green flag clicked | |
change [color v] effect by (50) | |
wait (2) seconds | |
clear graphic effects | |
end | |
""", | |
""" | |
when green flag clicked | |
hide | |
when I receive [start game v] | |
show | |
end | |
""", | |
""" | |
when green flag clicked | |
hide | |
end | |
""", | |
""" | |
when green flag clicked | |
go to [front v] layer | |
end | |
""", | |
""" | |
when this sprite clicked | |
go [forward v] (1) layers | |
end | |
""", | |
""" | |
say join [I am costume ] (costume [name v]) | |
""", | |
""" | |
say join [Current backdrop: ] (backdrop [name v]) for (2) seconds | |
""", | |
""" | |
set size to ( (size) + (10) ) | |
""", | |
# From sound_block.json | |
""" | |
when backdrop switches to [winning screen v] | |
play sound [fanfare v] until done | |
say [You won!] for (2) seconds | |
end | |
""", | |
""" | |
forever | |
play sound [Music v] until done | |
end | |
""", | |
""" | |
when this sprite clicked | |
start sound [Pop v] | |
change [score v] by (1) | |
end | |
""", | |
""" | |
when I receive [game over v] | |
stop all sounds | |
end | |
""", | |
""" | |
when [down arrow v] key pressed | |
change volume by (-5) | |
end | |
""", | |
""" | |
when green flag clicked | |
set volume to (50) % | |
end | |
""", | |
""" | |
say join [Current volume: ] (volume) | |
""", | |
# From event_block.json | |
""" | |
when green flag clicked | |
go to x: (0) y: (0) | |
say [Hello!] for (2) seconds | |
end | |
""", | |
""" | |
when [space v] key pressed | |
repeat (10) | |
change y by (10) | |
wait (0.1) seconds | |
change y by (-10) | |
end | |
end | |
""", | |
""" | |
when [right arrow v] key pressed | |
point in direction (90) | |
move (10) steps | |
end | |
""", | |
""" | |
when this sprite clicked | |
say [Ouch!] for (1) seconds | |
change [score v] by (-1) | |
end | |
""", | |
""" | |
when backdrop switches to [game over v] | |
stop [all v] | |
end | |
""", | |
""" | |
when [loudness v] > (70) | |
start sound [scream v] | |
end | |
""", | |
""" | |
when I receive [start game v] | |
show | |
go to x: (0) y: (0) | |
end | |
""", | |
""" | |
when I receive [game over v] | |
set score to 0 | |
stop [all v] | |
end | |
""", | |
""" | |
if <key [space v] pressed?> then | |
broadcast [jump v] | |
end | |
""", | |
""" | |
broadcast [initialize sprites v] and wait | |
say [Game Started!] for (2) seconds | |
""", | |
# From control_block.json | |
""" | |
say [Hello!] for (1) seconds | |
wait (0.5) seconds | |
say [Goodbye!] for (1) seconds | |
""", | |
""" | |
when green flag clicked | |
repeat (10) | |
move (10) steps | |
wait (0.1) seconds | |
end | |
end | |
""", | |
""" | |
when green flag clicked | |
forever | |
move (5) steps | |
if on edge, bounce | |
end | |
end | |
""", | |
""" | |
forever | |
if <touching [color (red) v]?> then | |
stop [this script v] | |
end | |
end | |
""", | |
""" | |
if <(score) > (10)> then | |
say [You win!] for (2) seconds | |
else | |
say [Keep trying!] for (2) seconds | |
end | |
""", | |
""" | |
repeat until <touching [edge v]?> | |
move (5) steps | |
end | |
""", | |
""" | |
if <(health) = (0)> then | |
stop [all v] | |
end | |
""", | |
""" | |
when I start as a clone | |
wait until <touching [edge v]?> | |
delete this clone | |
end | |
""", | |
""" | |
when I start as a clone | |
go to x: (pick random -240 to 240) y: (pick random -180 to 180) | |
show | |
forever | |
move (10) steps | |
if on edge, bounce | |
end | |
end | |
""", | |
""" | |
when I start as a clone | |
wait (5) seconds | |
delete this clone | |
end | |
""", | |
""" | |
when green flag clicked | |
hide | |
forever | |
create clone of [myself v] | |
wait (1) seconds | |
end | |
""", | |
# From data_block.json | |
""" | |
when green flag clicked | |
set [score v] to (0) | |
set [player name v] to [Guest] | |
end | |
""", | |
""" | |
when this sprite clicked | |
change [score v] by (1) | |
end | |
""", | |
""" | |
when green flag clicked | |
add [apple] to [shopping list v] | |
add [banana] to [shopping list v] | |
end | |
""", | |
""" | |
when green flag clicked | |
delete (all) of [my list v] | |
end | |
""", | |
""" | |
insert [orange] at (2) of [fruits v] | |
""", | |
""" | |
replace item (1) of [colors v] with [blue] | |
""", | |
""" | |
when green flag clicked | |
show variable [score v] | |
end | |
""", | |
""" | |
when I receive [game over v] | |
hide variable [score v] | |
end | |
""", | |
""" | |
when green flag clicked | |
show list [shopping list v] | |
end | |
""", | |
""" | |
when I receive [game over v] | |
hide list [shopping list v] | |
end | |
""", | |
""" | |
say ([score v]) for (2) seconds | |
""", | |
""" | |
say ([my list v]) | |
""", | |
""" | |
say (item (2) of [myList v]) for 2 seconds | |
""", | |
""" | |
say join (length of [shopping list v]) [ items in the list.] | |
""", | |
""" | |
if <(item # of [Dog] in [myList v])> (0)> then | |
say join [Dog found at position ] (item # of [Dog] in [my list v]) | |
end | |
""", | |
# From reporter_blocks.json (some already covered by other categories) | |
""" | |
when green flag clicked | |
say (x position) for (2) seconds | |
end | |
""", | |
""" | |
set [worms v] to (y position) | |
""", | |
""" | |
when green flag clicked | |
say (direction) for (2) seconds | |
end | |
""", | |
""" | |
say join [I am costume ] (costume [name v]) | |
""", | |
""" | |
set size to ( (size) + (10) ) | |
""", | |
""" | |
say join [Current backdrop: ] (backdrop [name v]) for (2) seconds | |
""", | |
""" | |
say join [Current volume: ] (volume) | |
""", | |
""" | |
if <(distance to [Sprite2 v]) < (50)> then | |
say [Too close!] | |
end | |
""", | |
""" | |
ask [What is your name?] and wait | |
say join [Hello ] (answer) | |
""", | |
""" | |
go to x: (mouse x) y: (mouse y) | |
""", | |
""" | |
if <(mouse y) < (0)> then | |
say [Below center] | |
end | |
""", | |
""" | |
when green flag clicked | |
forever | |
if <(loudness) > (30)> then | |
start sound [pop v] | |
end | |
""", | |
""" | |
when green flag clicked | |
reset timer | |
wait (5) seconds | |
say join [Time elapsed: ] (timer) | |
end | |
""", | |
""" | |
set [other sprite X v] to ( (x position) of [Sprite2 v] ) | |
""", | |
""" | |
say join [The current hour is ] (current [hour v]) | |
""", | |
""" | |
say join [Days passed: ] (days since 2000) | |
""", | |
""" | |
say join [Hello, ] (username) | |
""", | |
""" | |
set [total v] to ( (number 1) + (number 2) ) | |
""", | |
""" | |
set [difference v] to ( (number 1) - (number 2) ) | |
""", | |
""" | |
set [area v] to ( (length) * (width) ) | |
""", | |
""" | |
set [average v] to ( (total score) / (number of students) ) | |
""", | |
""" | |
go to x: (pick random -240 to 240) y: (pick random -180 to 180) | |
""", | |
""" | |
say (join [Hello ][World!]) | |
""", | |
""" | |
say (letter (1) of [apple]) | |
""", | |
""" | |
say (length of [banana]) | |
""", | |
""" | |
if <([number v] mod (2) = (0))> then | |
say [Even number] | |
end | |
""", | |
""" | |
set [rounded score v] to (round (score)) | |
""", | |
""" | |
set [distance v] to ([sqrt v] of ( ( (x position) * (x position) ) + ( (y position) * (y position) ) )) | |
""", | |
# From boolean_blocks.json (conditions already covered by parse_condition) | |
""" | |
if <(score) < (10)> then | |
say [Keep trying!] | |
end | |
""", | |
""" | |
if <(answer) = (5)> then | |
say [Correct!] | |
end | |
""", | |
""" | |
if <([health v]) > (0)> then | |
move (10) steps | |
else | |
stop [all v] | |
end | |
""", | |
""" | |
if <<mouse down?> and <touching [mouse-pointer]?> > then | |
say [You're clicking me!] | |
end | |
""", | |
""" | |
if <<key [left arrow v] pressed?> or <key [a v] pressed?>> then | |
change x by (-10) | |
end | |
""", | |
""" | |
if <not <touching [Sprite2 v]?>> then | |
say [I'm safe!] | |
end | |
""", | |
""" | |
if <[answer] contains [yes]?> then | |
say [Great!] | |
end | |
""", | |
""" | |
if <touching [Sprite v]?> then | |
broadcast [Game Over v] | |
end | |
""", | |
""" | |
if <touching [edge v]?> then | |
bounce off edge | |
end | |
""", | |
""" | |
if <touching color [#FF0000]?> then | |
change [health v] by (-1) | |
end | |
""", | |
""" | |
if <color [#00FF00] is touching [#FF0000]?> then | |
say [Collision!] | |
end | |
""", | |
""" | |
forever | |
if <key [space v] pressed?> then | |
broadcast [shoot v] | |
end | |
end | |
""", | |
""" | |
if <mouse down?> then | |
go to mouse-pointer | |
end | |
""", | |
""" | |
if <[inventory v] contains [key]?> then | |
say [You have the key!] | |
end | |
""", | |
# Custom block example | |
""" | |
define jump (height) | |
change y by (height) | |
wait (0.5) seconds | |
change y by (0 - (height)) | |
end | |
when green flag clicked | |
jump (50) | |
end | |
""" | |
] |