Collision Detection

Now we'll program the collision detection on your image. Right-click on your image and select Edit Script.

We want to make your image become visible when the player overlaps it, and we'll do that by constantly checking if the image overlaps with the player. We'll need to find the blocks to program this. Let's start with the constantly block.

Open Events, and drag Constantly below the other blocks.

Now grab the if block from Control Flow, and drag it into the Constantly block.

Open Sensing and find the myself overlaps instance Toucher block and connect it to the if block. Then click on Toucher and change it to player.

Lastly, open Looks and grab the block set visibility of myself to true. Drag this block inside the if block.

Now when the player overlaps your image, the image will become visible. Click Play to test it out.

results matching ""

    No results matching ""