Discuss Scratch

matt4kj
Scratcher
76 posts

I need help doing the falling cookies like in cookie clicker on my clicker game

Hi! I need help making a clone script that spawns a new ghost clone in the background. Here is the my game: https://scratch.mit.edu/projects/872050801
BigEmster
Scratcher
100+ posts

I need help doing the falling cookies like in cookie clicker on my clicker game

Your second
whenclicked
script isn't working because you've placed
playsoundLFZ - Popside [NCS Release]untildone
inside of it. The “until done” part means that Scratch will wait for the sound to finish playing before it continues with the script. I suggest moving this to a new
whenclicked
script, possibly within an entirely new sprite as well.

I've also noticed that you have a forever loop inside a forever loop. I assume this was a mistake, and you had forgotten you were already in a forever loop, so make sure to take that out because it will cause problems too.

Let me know if you still have any problems, I'll be happy to help!
matt4kj
Scratcher
76 posts

I need help doing the falling cookies like in cookie clicker on my clicker game

Ok thxs i'll try that
matt4kj
Scratcher
76 posts

I need help doing the falling cookies like in cookie clicker on my clicker game

BigEmster wrote:

Your second
whenclicked
script isn't working because you've placed
playsoundLFZ - Popside [NCS Release]untildone
inside of it. The “until done” part means that Scratch will wait for the sound to finish playing before it continues with the script. I suggest moving this to a new
whenclicked
script, possibly within an entirely new sprite as well.

I've also noticed that you have a forever loop inside a forever loop. I assume this was a mistake, and you had forgotten you were already in a forever loop, so make sure to take that out because it will cause problems too.

Let me know if you still have any problems, I'll be happy to help!


It still doesn't work
matt4kj
Scratcher
76 posts

I need help doing the falling cookies like in cookie clicker on my clicker game

Would you mind writing a script that works? You don't have to
BigEmster
Scratcher
100+ posts

I need help doing the falling cookies like in cookie clicker on my clicker game

Firstly, the leftmost green flag script looks to be doing the same thing the other one does, so it can be thrown out. This will also put your coin back into the middle of the screen where I assume you meant for it to go.

Next, I'm noticing that your
waituntilnottouchingmouse-pointer?
is also preventing Scratch from continuing to run the rest of the code. I suggest replacing this segment of code
iftouchingmouse-pointerthenchangesizeby2wait0secondschangesizeby4waituntilnottouchingmouse-pointer?changesizeby-4wait0secondschangesizeby-2
with this
iftouchingmouse-pointerthenifsize=100thensetsizeto102% make the coin medium (the animation is now halfway complete)elseifsize=102thensetsizeto106% make it big (the animation is now complete). if the coin is already medium and the coin is smallelseifsize=106thensetsizeto102% make it medium again (again, halfway animated)elseifsize=102thensetsizeto100% make it small (again, fully animated) and if it's already medium If we are NOT hovering over the coin, and it is big If we are hovering over the coin
Because using wait blocks can interfere with the rest of the code, we can't use them to make sure each frame of the animation displays. Instead, we will let the loop finish, so the frame displays, then come back to finish the animation when we loop back around again.

Hopefully that all makes sense?

Also, real quick now that I've noticed it, under the “when I start as a clone” you should use
gotox:pickrandom-240to240y:159
instead of the “go to random position” block so that the coins always start at the top of the screen. I use the y value 159 instead of 180 (the highest pixel in Scratch's stage) so that the coins aren't cut off the top of the screen when they start off.

Last edited by BigEmster (Oct. 12, 2023 03:05:15)

matt4kj
Scratcher
76 posts

I need help doing the falling cookies like in cookie clicker on my clicker game

Can you remix it and have the code done? Pls I don't rlly understand that
BigEmster
Scratcher
100+ posts

I need help doing the falling cookies like in cookie clicker on my clicker game

Here is the project link.

I think it makes more sense to teach you to do this than to just do it for you, that way you know how it works and can use it again later. You've asked me to do it for you, so I did, but don't hesitate to ask any questions about how it works!
NhitMit2012
Scratcher
28 posts

I need help doing the falling cookies like in cookie clicker on my clicker game

For the

playsounduntildone

block, you could just replace it with a “start sound” block.
BigEmster
Scratcher
100+ posts

I need help doing the falling cookies like in cookie clicker on my clicker game

NhitMit2012 wrote:

(#9)
For the

playsounduntildone

block, you could just replace it with a “start sound” block.
Lol, that wouldn't work because it's in a forever loop. The sound would be constantly restarting and interrupting itself.
matt4kj
Scratcher
76 posts

I need help doing the falling cookies like in cookie clicker on my clicker game

BigEmster wrote:

Here is the project link.

I think it makes more sense to teach you to do this than to just do it for you, that way you know how it works and can use it again later. You've asked me to do it for you, so I did, but don't hesitate to ask any questions about how it works!

Well I could but thxs for helping if I have any issues I will ask again!
BigEmster
Scratcher
100+ posts

I need help doing the falling cookies like in cookie clicker on my clicker game

matt4kj wrote:

(#11)
Well I could but thxs for helping if I have any issues I will ask again!
Ofc man no problem
matt4kj
Scratcher
76 posts

I need help doing the falling cookies like in cookie clicker on my clicker game

Can you make it so that it doesn't overlap and it doesn't go behind the upgrades? Also my user is @matt4kj not @matt5kj
BigEmster
Scratcher
100+ posts

I need help doing the falling cookies like in cookie clicker on my clicker game

I changed the project, is this what you wanted?
matt4kj
Scratcher
76 posts

I need help doing the falling cookies like in cookie clicker on my clicker game

Ok ill have a look thxs
BigEmster
Scratcher
100+ posts

I need help doing the falling cookies like in cookie clicker on my clicker game

np

Powered by DjangoBB