Discuss Scratch

GDplague
Scratcher
33 posts

how to make a sprite get the name of the sprite it touched

setTouched Nameto"Touched Sprite Name"
deck26
Scratcher
1000+ posts

how to make a sprite get the name of the sprite it touched

Not possible other than going through a list of sprite names and checking for touching each one. You can do that in a loop in a custom block with no screen refresh.
HappyKid54321
Scratcher
100+ posts

how to make a sprite get the name of the sprite it touched

I think this is impossible. Sorry

standing_rake
Scratcher
55 posts

how to make a sprite get the name of the sprite it touched

HappyKid54321 wrote:

I think this is impossible. Sorry


Not true. Depending on the shape, it might be possible. If you are using circles, https://scratch.mit.edu/projects/883303054/editor/ could work on a sprite level, although both sprites would need to work together. It would also work for squares too, but the distance calculator would need to be changed.
scratch___user12345
Scratcher
1000+ posts

how to make a sprite get the name of the sprite it touched

deck26 wrote:

Not possible other than going through a list of sprite names and checking for touching each one. You can do that in a loop in a custom block with no screen refresh.
Here is an implementation of what @deck26 suggested:
definefindspritetouchingsetito0repeatlengthofEvery Sprites Namechangeiby1iftouchingitemiofEvery Sprites Name?thensettouched nametoitemiofEvery Sprites Name
GDplague
Scratcher
33 posts

how to make a sprite get the name of the sprite it touched

scratch___user12345 wrote:

deck26 wrote:

Not possible other than going through a list of sprite names and checking for touching each one. You can do that in a loop in a custom block with no screen refresh.
Here is an implementation of what @deck26 suggested:
definefindspritetouchingsetito0repeatlengthofEvery Sprites Namechangeiby1iftouchingitemiofEvery Sprites Name?thensettouched nametoitemiofEvery Sprites Name

God bless you
Godzillaplayer
Scratcher
4 posts

how to make a sprite get the name of the sprite it touched

scratch___user12345 wrote:

deck26 wrote:

Not possible other than going through a list of sprite names and checking for touching each one. You can do that in a loop in a custom block with no screen refresh.
Here is an implementation of what @deck26 suggested:
definefindspritetouchingsetito0repeatlengthofEvery Sprites Namechangeiby1iftouchingitemiofEvery Sprites Name?thensettouched nametoitemiofEvery Sprites Name

would this work for color detection?
cookieclickerer33
Scratcher
1000+ posts

how to make a sprite get the name of the sprite it touched

Godzillaplayer wrote:

scratch___user12345 wrote:

deck26 wrote:

Not possible other than going through a list of sprite names and checking for touching each one. You can do that in a loop in a custom block with no screen refresh.
Here is an implementation of what @deck26 suggested:
definefindspritetouchingsetito0repeatlengthofEvery Sprites Namechangeiby1iftouchingitemiofEvery Sprites Name?thensettouched nametoitemiofEvery Sprites Name

would this work for color detection?
yes if you had a list of every hex color you want

Powered by DjangoBB