Its hard for someone moving from block based programming to Python to understand directly, what are classes and object instances, etc. So, we made it more simple in CodeSkool Scratch to learn Python programming, by providing simple python functions instead of method call on Sprite object instances to control the sprite in the project. Here is the list of python functions that we are supporting currently:
- input
- move_steps
- turn_right
- turn_left
- goto_position
- goto_xy
- get_x
- get_y
- get_direction
- set_direction
- point_towards
- change_x
- change_y
- set_x
- set_y
- bounce_if_on_edge
- set_rotation_style
- sprite_says
- sprite_think
- switch_costume
- next_costume
- switch_backdrop
- next_backdrop
- change_size
- set_size
- change_effect
- set_effect
- clear_effects
- show_sprite
- hide_sprite
- go_to_layer
- change_layer
- get_costume
- get_backdrop
- get_sprite_size
- play_until_done
- play_sound
- stop_all_sounds
- change_sound_effect
- set_sound_effect
- clear_sound_effects
- change_volume
- set_volume_to
- get_volume
- create_clone
- is_touching
- is_touching_color
- distance_to
- ask_question
- get_answer
- is_key_pressed
- mouse_x
- mouse_y
- get_loudness
- get_timer
- reset_timer
- get_sprite_current
- days_since_2000
- get_username
- broadcast_message
- broadcast_and_wait
- pen_down
- pen_up
- pen_clear
- pen_stamp
- pen_set_color
- pen_change_color
- pen_set_size
- pen_change_size
We have changed some of the function names to avoid any namespace collision with other user defined functions or variables having similar names . For example, instead of x() or y() or direction(), you now have to use get_x(), get_y(), get_direction(). Similarly, changed names and added sprite to make the function more clear to use like: sprite_says(), show_sprite(), get_sprite_current(), etc.
Some namespace collision with other user defined functions or variables can occur still, but we think this is still a decent tradeoff between ease of use and standards.