Egg hunt Tutorial


#1

Hi @everyone

I am trying to create a game similar to Egg Hunt but I have problems with coding. It would be possible that somebody explain how to collect objects and when you have all of them collected, show a message ( something like the game that is in the gallery).

I started creating a list but after I don´t know how to continue:sweat::sweat:
Thanks in advance
Begoña


#2

Check out our lesson on variables here it will show u how to pick up a certain amount of items that require an if/else statement


#3

Thanks for your advise. I did it. I will review the tutorial again step by step.

Great work in this website. .


#4

no problem glad you like it :slight_smile:


#5

This is the space.


I need to find/ collect 6 objects: Fancy woman, train, gorilla, parrot, park bench, treasure chest. When I pass the mouse the objects disappear. But when all of them are out of scene it should there be a text saying: “Well done”.
Could @Stefan or somebody have a look to the code and tell me the next step. Thanks


#6

Hi @Bcodesal,

you’ve created two different scripts in your space in which the reconto variable is checked if it’s length is 6. Right now, variables only exist in the same script in which they’re created in and can not communicate across different scripts.

This means that each of your reconto variables are unique to each script.

To solve this, simply create a forever loop at the end of your first script to check for the length of the reconto variable.

Below is a space that demonstrate code improvements to your space. Please press the remix button to get a copy of it and see what has changed. Hope this helps! :slight_smile:

Some more notes:

  • variable names are case sensitive (Reconto and reconto are two different variables).
  • you can use the add item to list - block to dynamically add items to the end of your list variable, so you do not have to define the index at which you want to add the variable yourself.

#7

Thanks @Stefan!

Let’s see if I can arrrange it . :stuck_out_tongue_winking_eye::sweat_smile::sweat_smile:

Begoña


#8

I have just seen the projec you share with me! Now works perfectly well!
Thank you very much for your help, @stefan.


#9

Sure thing, always welcome :slight_smile: