Speedow

I need help with collecting coins. You can see only one coin and after you collected that coin will hide and teleport to another place and show. My coin work for 2 places and after second collect didnt work. My cycle is always stuck. Does anyone have any advice as to how to do that? Thank you

imfh

Could you share the project and link? That will help us give you better advice.

You might want to try using clones. You could create clones of the coin sprite and tell them where to go. That way you can have multiple coins on the screen at the same time.

Speedow

https://scratch.mit.edu/projects/321345142/ this is my game
https://ctrlv.cz/phwm and this my simple code i need simple code because i want add text when you collect coin

Speedow

when green flag clicked
show
go to x: (206) y: (64)
forever
if <> then
<touching [ v] ?>
hide
go to x: (208) y: (-17)
show
if <> then
<touching [ v] ?>
hide
go to x: (206) y: (-68)
show
if <> then
<touching [ v] ?>
hide
go to x: (208) y: (-68)
end
end
end
end
i cant write it sorry

codeman1044

I'll fix it for any other viewer.
when green flag clicked
show
go to x: (206) y: (64)
forever
if <touching [ v] ?> then
hide
go to x: (208) y: (-17)
show
if <touching [ v] ?> then
hide
go to x: (206) y: (-68)
show
if <touching [ v] ?> then
hide
go to x: (208) y: (-68)
I think that's correct. Let me know if I'm wrong. I'm not sure what's supposed to go into the touching booleans though.

Speedow

when green flag clicked
show
go to x: (206) y: (64)
forever
if <touching [flower v] ?> then
hide
go to x: (208) y: (-17)
end
show
if <touching [flower v]> then
hide
go to x: (206) y: (-68)
end
show
if <touching [flower v]> then
hide
go to x: (208) y: (-68)
end
end

yes i like your pic
this is my code but my coin everytime is stuck between second and third position and i dont know how to unstuck it

codeman1044

Judging by the fact that your y position stays consistent (-68) and that you're changing the x position by only 2 your coin is probably going to get stuck. Make sure your coordinates are correct.

Speedow

my coordinates are correct but in forewer do this second coordinates i can collect and that coin hide and teleport to third coordinates but if i want collect this my code go back so that coin from third hide but show at second coordinates

a-jar-of-tuna

you should change your script because having three if statements with the same conditions in a forever loop may cause problems
when green flag clicked
forever
wait until <touching [flower v] ?>
go to x: (208) y: (-17)
wait until <touching [flower v] ?>
go to x: (206) y: (-68)
wait until <touching [flower v] ?>
go to x: (208) y: (-68)

a-jar-of-tuna

^^ never mind that, sorry
I think you're looking for the original position (x: 206 y: 64)?
Since the second and third are so close to each other, the flower will touch coordinate #2 and #3 so fast and return to the first one, creating the illusion that only two of them are working. Maybe add the original position as the first coordinate in the loop?

(and please recheck the link it doesn't seem to be working)

Speedow

It worked Thank you guys!!!!!! And one more thing i need add text if i collect coin it will show text and maybe with n that text hide.

a-jar-of-tuna

To show text, you should create a new sprite and write the text in a costume. Then, write two scripts for that sprite, where both should look something like this
when green flag clicked
hide

when I receive [showtext v]
show
wait (1) secs
hide
(you can change the animation)
Then, in the character sprite, you have to put a
broadcast [showtext v]
after the
wait until <touching [flower v] ?>
for each.

Happy coding!