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

1 Like

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

2 Likes

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?

1 Like

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

1 Like

Hi Geoff,

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

Thanks you
Aline

1 Like

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

1 Like

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

1 Like

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

Good luck!
Geoff @ TechLeap

1 Like

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

Now it only move one time on the path.

1 Like

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?

2 Likes

Ok I got it. Thank you.

2 Likes

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

Many thanks,
Geoff @ TechLeap

1 Like