Many tutorials on how to create a game in Scratch will be based on using the arrow keys to control the main sprite. This is a great approach indeed but is not suitable if you are designing the game toe be used on a tablet or smartphone. In this case, your input device to control the main sprite is not the keyboard but the touchscreen.
The following short tutorial will show you how you can control the movement of your sprite (in this case the cat) using a touchscreen. The idea will be to create two other sprites/buttons called Arrow_Left and Arrow_Right that, when clicked using a mouse or tapped using a touchscreen will tell the cat sprite to move in the relevant direction.
You can recreate this code online using the scratch website.
Step 1: Arrow_Right Sprite
You will need tot create a new sprite and use the arrow sprite from the scratch library.
You should rename this sprite “Arrow_Right”.
You will then need to add the following code to this sprite to detect when the user clicks or taps on this sprite:
Step 2: The Arrow Left
Repeat the instructions from Step 1 to create another arrow sprite and call it “Arrow_Left”. The code for this new sprite will be as follows:
You will also need to change the costume of this sprite to show an arrow pointing to the left: