How to use the Move and Hide Blocks: Hide and Seek Coding

Ready to programme a classic game of hide-and-seek? Today, we are combining two essential ScratchJr blocks: the Move block (to change location) and the Hide block (to vanish) to make a character disappear perfectly behind an object on screen.

Our project will demonstrate this skill by having Kitten play hide-and-seek with their friend, the Fairy, in the park. This teaches children how to sequence actions and create the illusion of a character moving off-screen or behind an object.

Setting the Scene for Hide-and-Seek

First, we need to set our stage and introduce our characters:

  1. Change the Background: Select the park background. This setting has a large tree, which makes for a great hiding spot! [00:21]
  2. Add Characters: Add the Fairy character to the project. [00:33]
  3. Position Characters: Arrange Kitten and the Fairy on the screen. For Kitten, place them a suitable distance from the hiding spot (the tree) to allow for the movement animation.

We will only be coding the Kitten icon, as Kitten is the one doing the hiding.

Coding Kitten’s Coordinated Hiding Action

Kitten needs to move in two directions (across and up) and then disappear at the exact right moment.

  1. Start Block: Begin the script with the Green Flag trigger block (yellow category). [01:03]
  2. Move Across: Use the Move Right block (blue category) to make Kitten walk horizontally toward the tree. [01:10]
    • Tip for Distance: You will need to check your grid to set the number of steps precisely. The video suggests around 13 or 14 steps to get Kitten right to the edge of the tree. [01:34]
  3. Move Up: Immediately follow this with the Move Up block (blue category) to make Kitten walk vertically into the tree’s foliage. [01:15]
    • Tip for Distance: Set this to a small number (e.g., 3) so Kitten moves up a short distance. [01:54]
  4. Hide: Go to the purple Looks category and add the Hide block. This command will execute immediately after the move, making Kitten vanish as they reach the tree. [01:22]
  5. End Block: Finish the script with the red End block. [01:28]

Running the Programme

When you press the Green Flag, Kitten will execute the sequence of ScratchJr blocks perfectly: they walk across, move up, and then disappear right behind the tree, creating a very convincing hiding animation! [02:35]

This is a fantastic exercise for understanding action sequencing and is a great addition to our coding tutorials. If you’re looking for structured coding challenges, explore our collection of ready-made lessons. Happy coding!