Movement
Different ways of movement. Using the default sprite, try and test each of these scripts:event key triggers

key sensors with axis changes

key sensors with direction changes

follow mouse pointer

follow mouse click - uses broadcast
Create a pointer sprite that we will use as a marker to record the last mouse click:
pointer sprite script:

cat sprite script:

Broadcast in Scratch can be similiar to a GOTO statement in coding / programming, which may lead to Spaghetti Code. Be careful of the timing of broadcast triggers if you have queue of instructions that must be serially processed.
questions
- Explain what happens if you change the rotation style in the Follow mouse pointer example (above) to:
- left-right
- don't rotate
- Create a new movement script where the default sprite doesn't stop moving in the chosen direction after I have taken my finger off the arrow key (or mouse button).