0% found this document useful (0 votes)
4 views2 pages

MBlock Python Sprite Cheat Sheet

The document is a cheat sheet for mBlock Python commands related to sprite motion, looks, sound, control, sensing, and pen functionalities. It provides a list of commands along with their descriptions for easy reference. An example sequence of commands is also included to demonstrate their usage.

Uploaded by

dodymha9
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

MBlock Python Sprite Cheat Sheet

The document is a cheat sheet for mBlock Python commands related to sprite motion, looks, sound, control, sensing, and pen functionalities. It provides a list of commands along with their descriptions for easy reference. An example sequence of commands is also included to demonstrate their usage.

Uploaded by

dodymha9
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

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]()

You might also like