Microsoft MakeCode

Problem when creating a ranking for a treasure hunt

Good morning!

I’m Elena, a teacher from Spain and I’m trying to create a game where the students would look for a microbit (TREASURE) with the help of different micro:bits connected by radio (FINDER). I want to create a ranking so that the students will know the order of the groups that have found the “Treasure” micro:bit. I have created the following code:


They both send the signals and when “Finder” is near “Treasure”, this one should prompt “Winner 1”.

The problem comes when it doesn’t wait until the micro:bit Finder is near, and it prompts “Winner 1” and also, it doesn’t stop counting: winner 1, 2, 3… without another micro:bit around.

What I would like for it would be to wait for the following micro:bit to arrive next to it, so that it would be winner 2. How could I make it?
Thanks a million!

Here’s how I would do this:

I added comments to the code to explain what I’m doing. Let me know if you have any questions!

1 Like

THANKS a million, Richard!!! :smiling_face_with_three_hearts: