mBlock Python - Sprite Cheat Sheet
Motion
Command Description
[Link](100) Move forward
sprite.turn_right(90) Turn right
sprite.turn_left(90) Turn left
sprite.go_to(0,0) Go to position
sprite.glide_to(100,50,2) Glide smoothly
sprite.set_x(100) Set X
sprite.set_y(50) Set Y
sprite.change_x(20) Change X
sprite.change_y(-20) Change Y
sprite.point_in_direction(90) Face a direction
sprite.point_towards("Mouse") Face the mouse
Looks
Command Description
[Link]("Hello",2) Talk
[Link]("Hmm",2) Think
[Link]() Show sprite
[Link]() Hide sprite
sprite.set_size(100) Set size
sprite.change_size(20) Change size
sprite.next_costume() Next costume
sprite.switch_costume("costume1") Switch costume
sprite.clear_graphic_effects() Clear effects
Sound
Command Description
sprite.play_sound("sound") Play sound
sprite.play_sound_until_done("sound") Play and wait
sprite.stop_all_sounds() Stop sounds
sprite.set_volume(100) Set volume
Control
Command Description
[Link](1) Wait
[Link]("Start") Send message
sprite.broadcast_and_wait("Start") Send & wait
Sensing
Command Description
[Link]("Mouse") Touching mouse?
sprite.touching_edge() Touching edge?
[Link]("Name?") Ask question
[Link]() User answer
sprite.mouse_x() Mouse X
sprite.mouse_y() Mouse Y
Pen
Command Description
sprite.pen_down() Start drawing
sprite.pen_up() Stop drawing
sprite.set_pen_color("#ff0000") Pen color
sprite.set_pen_size(3) Pen size
[Link]() Clear drawing
Example
[Link]()
[Link]("Hello!",2)
[Link](100)
sprite.turn_right(90)
sprite.change_size(30)
[Link]("I'm happy!",2)
[Link]()