Play catch while moving on a path

Good morning,

I want to build a catch game.
A person is running on a track and you have to click this person 3 times. After that the person stops and says something.

At the moment the person does not stop and is not able to say something. Can somebody help?


Thanks a lot!
Aline

Hallo Aline,

In your set variable block, the value is a text string datatype by default (“3”, not 3). This often causes problems because if you use a change block the datatype is a number (0, not “0”).

The solution is to drag a number value block into the value field of your Richtig variable:

Now the conditional statement can be calculated correctly.

Hope that helps! Let me know if you have any further questions.

Geoff @ TechLeap

1 Like

Thank you @techleapnz

Now the girl is able to say something after clicking her 3 times. But she is still running on path. How can I change that? Any ideas?

Hi Aline,

Click on the debug code icon in the top right corner, whilst playing your space. This will help you see which parts of your code are running and which aren’t.

From here you may be able to see what needs to be changed to get the result you want.

Have a go, and let me know how you get on.

Good luck!

Geoff @ TechLeap

Hi Geoff,

I already did that. Everything is running but the “move … on path …” does not stop. Can you help?

Thanks you
Aline

That’s correct - the move on path doesn’t stop, because it’s in a forever loop. It needs the break out of loop CoBlock to stop. Can you set a condition inside the loop that will break out when you want it to?

Good luck!
Geoff @ TechLeap

I already tried, but it is not working. Where do I have to place the “break out” CoBlock?

Read my previous answer again - I mentioned that it needs to be inside the loop.

Good luck!
Geoff @ TechLeap

I did but to be honest I don’t get it:

Now it only move one time on the path.

You need to put in a condition in there, so the break out of loop is actioned only when you want it to be actioned, ie, when do you want it to stop moving on the path?

1 Like

Ok I got it. Thank you.

1 Like

Great! Well done! Please mark this topic as solved!

Many thanks,
Geoff @ TechLeap