Control the Sprites using Python

Use Python to control the Stage background and Sprites and perform the same effect as is Scratch programming.

    1. Learn Python based on the Scratch.
    1. It is more convenient to do coding than dragging and dropping the statement block.

Start using Python

Press the Python icon on the top right corner toolbar to pop the Python script area.

Scratch Code Blocks convert to Python

Drag a Scratch Block to the script area will generate the corresponding Python code.

Mobile wizard

move\ (distance)

sprite.move(10)

right(angle)

sprite.right(15)

left(angle)

sprite.left(15)

direction(angle)

sprite.direction(105)

Position and coordinates

Move the character to the specified x,y coordinates on the screen

#Move to the (10,10) coordinates
sprite.gotoxy(10,10)

Move the character to the specified location on the screen

# Move to random location
sprite.moveto('random')

#Move to the mouse
sprite.moveto('mouse')

Let the character slide to the specified x,y coordinates on the screen within the specified time to allow the character to slide to the specified x,y coordinates on the screen within the specified time.

#Slide to (9, -110) coordinates within 1 second
sprite.glide(9,-110,1)

Let the character slide to the specified position on the screen within the specified time

#Swipe to random position within 1 second
sprite.glideto('random',1)

#Swipe to the mouse within 1 second
sprite.glideto('mouse',1)

Role appearance

Let the character "speak" or "think" the specified text on the screen

#Disappears after 2 seconds
sprite.say('Hello!',2)

#Always show
sprite.say('Hello!')
#Disappears after 2 seconds
sprite.think('Hmm...',2)
Always show
sprite.think('Hmm...')

"Show" and "Hide" of the character

#Show
sprite.show()

#Hide
sprite.hide()