Discuss Scratch

SuperGamerGG2
Scratcher
69 posts

How to stop clone freezing?

Hey guys, I'm working on a project, but when the player runs into the Clone Candy, the candy freezes.
Heres the code I'm using:
when I start as a clone
repeat until <touching color [#color] ?>
change y by (-5)
end
if <touching color [#color] ?> then
go to [bucket v]
repeat (10)
change size by (-10)
delete this clone

end
end

Hi! I'm SuperGamerGG2. Click on the links below!

My Profile | Define Scratch | My BFB Camp Team | Game
SuperGamerGG2
Scratcher
69 posts

How to stop clone freezing?

It might not be the exact same code, but I still need help!
https://scratch.mit.edu/projects/986342505/
My browser / operating system: ChromeOS 14541.0.0, Chrome 118.0.0.0, No Flash version detected


Hi! I'm SuperGamerGG2. Click on the links below!

My Profile | Define Scratch | My BFB Camp Team | Game
-effortIess-
Scratcher
100+ posts

How to stop clone freezing?

Instead of
when I start as a clone
repeat until <touching color [#color] ?>
change y by (-5)
end
if <touching color [#color] ?> then
go to [bucket v]
repeat (10)
change size by (-10)
delete this clone

end
end
Use
when I start as a clone
repeat until <touching color [#color] ?>
change y by (-5)
end
go to [bucket v]
repeat (10)
change size by (-10)
delete this clone

end


Support the suggestion HERE by adding this button to your signature

BAN PI DAY!!! (joke)

100th post
SuperGamerGG2
Scratcher
69 posts

How to stop clone freezing?

-effortIess- wrote:

Instead of
when I start as a clone
repeat until <touching color [#color] ?>
change y by (-5)
end
if <touching color [#color] ?> then
go to [bucket v]
repeat (10)
change size by (-10)
delete this clone

end
end
Use
when I start as a clone
repeat until <touching color [#color] ?>
change y by (-5)
end
go to [bucket v]
repeat (10)
change size by (-10)
delete this clone

end
Ok, i tried that, but now it glides to the bucket and freezes. any ideas?

Hi! I'm SuperGamerGG2. Click on the links below!

My Profile | Define Scratch | My BFB Camp Team | Game
SuperGamerGG2
Scratcher
69 posts

How to stop clone freezing?

Hey, anybody got any fixes?

Hi! I'm SuperGamerGG2. Click on the links below!

My Profile | Define Scratch | My BFB Camp Team | Game
RokCoder
Scratcher
1000+ posts

How to stop clone freezing?

If you want a proper answer then you need to share your project so that people aren't guessing at what other factors may be involved


Scratch dabbling for fun…

SuperGamerGG2
Scratcher
69 posts

How to stop clone freezing?

RokCoder wrote:

If you want a proper answer then you need to share your project so that people aren't guessing at what other factors may be involved
it is shared

Hi! I'm SuperGamerGG2. Click on the links below!

My Profile | Define Scratch | My BFB Camp Team | Game
deck26
Scratcher
1000+ posts

How to stop clone freezing?

You only delete the clone if it was touching the colour at the top of the bucket. So if the candy hits the side of the bucket it stops moving but never sees the code to delete itself.
RokCoder
Scratcher
1000+ posts

How to stop clone freezing?

SuperGamerGG2 wrote:

RokCoder wrote:

If you want a proper answer then you need to share your project so that people aren't guessing at what other factors may be involved
it is shared
Sorry - I missed that comment when I looked through before.

when I start as a clone
repeat until <touching color [#2c826f] ?>
change y by (-5)
turn cw (5) degrees
end
set [_index v] to (1) // _index is a "for this sprite only" variable
repeat (5)
change x by (((([x position v] of [bucket v]) - (x position)) / (5)) * (_index))
change y by (-5)
turn cw (5) degrees
change size by (-10)
change [index v] by (1)
end
hide
change [Candy: v] by (1)
change [clones v] by (-1)
delete this clone


Scratch dabbling for fun…

SpyCoderX
Scratcher
100+ posts

How to stop clone freezing?

deck26 wrote:

You only delete the clone if it was touching the colour at the top of the bucket. So if the candy hits the side of the bucket it stops moving but never sees the code to delete itself.
In other words, the “if touching color <brown>” shouldn't be there.

I rewrote a few things to make it better:
when I start as a clone
repeat until <<touching [Bukkit v]?>or<(y position) < (-170)>> //Move down until you hit the bukkit or the ground
change y by (-5)
turn cw (5) degrees
end
if <touching [Bukkit v]> then //If you hit the bukkit then do the bukkit stuff
glide (0.2) secs to [Bukkit v] ::motion
repeat (5)
change size by (-10)
end
change [Candy: v] by (1)
end
change [clones v] by (-1) //In any case, you hit something so you should delete this clone.
delete this clone

New game! (link)
Have a good day/night!


\(-_-) ::#00AAAA //This is crypto. He protects my signature from the evil kumquats!
Programming is a very powerful skill. As are critical thinking and hard work.
- SpyCoderX


RokCoder
Scratcher
1000+ posts

How to stop clone freezing?

Or you could use the solution I gave you which has the candy falling into the centre of the bucket no matter whether it's moving or not…


Scratch dabbling for fun…

SuperGamerGG2
Scratcher
69 posts

How to stop clone freezing?

SpyCoderX wrote:

deck26 wrote:

You only delete the clone if it was touching the colour at the top of the bucket. So if the candy hits the side of the bucket it stops moving but never sees the code to delete itself.
In other words, the “if touching color <brown>” shouldn't be there.

I rewrote a few things to make it better:
when I start as a clone
repeat until <<touching [Bukkit v]?>or<(y position) < (-170)>> //Move down until you hit the bukkit or the ground
change y by (-5)
turn cw (5) degrees
end
if <touching [Bukkit v]> then //If you hit the bukkit then do the bukkit stuff
glide (0.2) secs to [Bukkit v] ::motion
repeat (5)
change size by (-10)
end
change [Candy: v] by (1)
end
change [clones v] by (-1) //In any case, you hit something so you should delete this clone.
delete this clone
ok. but i dont want the candy going in when it touches the sides.

Hi! I'm SuperGamerGG2. Click on the links below!

My Profile | Define Scratch | My BFB Camp Team | Game
RokCoder
Scratcher
1000+ posts

How to stop clone freezing?

SuperGamerGG2 wrote:

ok. but i dont want the candy going in when it touches the sides.
Don't go with my solution then


Scratch dabbling for fun…

SuperGamerGG2
Scratcher
69 posts

How to stop clone freezing?

ok i fixed it ! i just needed to delete the clone for both if's

Hi! I'm SuperGamerGG2. Click on the links below!

My Profile | Define Scratch | My BFB Camp Team | Game
SuperGamerGG2
Scratcher
69 posts

How to stop clone freezing?

when [ code fixed v]
say [Topic] for (2) secs
say [Closed!] for (2) secs
close topic with smile

Hi! I'm SuperGamerGG2. Click on the links below!

My Profile | Define Scratch | My BFB Camp Team | Game
deck26
Scratcher
1000+ posts

How to stop clone freezing?

So is it fixed now?
SuperGamerGG2
Scratcher
69 posts

How to stop clone freezing?

deck26 wrote:

So is it fixed now?
yes

Hi! I'm SuperGamerGG2. Click on the links below!

My Profile | Define Scratch | My BFB Camp Team | Game

Powered by DjangoBB