"Touching sprite" block behavior with clones?
See original GitHub issueIn Scratch, the “touching (sprite)” block will return true if the current sprite is touching the other sprite or any of its clones. In scratch-js, it only returns true if it’s touching the original sprite.
I think a good solution would be to retain the current behavior if you pass a sprite instance to touching()
, but to use Scratch’s behavior if you pass the sprite’s base class. I’d like to get your opinion on it.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6
Top Results From Across the Web
"Touching sprite" block behavior with clones? #25 - GitHub
In Scratch, the "touching (sprite)" block will return true if the current sprite is touching the other sprite or any of its clones....
Read more >Touching Sprite block returns true for clones - Discuss Scratch
I'm making a multiplayer kart battle mode in a game, and you'd have to use items to deal damage. The items for each...
Read more >Cloning - Scratch Wiki
Cloning is a feature that allows a sprite to create a copy of itself while the project is running. Each clone has the...
Read more >How do I make an "If player Touching <costume> of clone ...
But, I tried the "costume #/name of sprite" block but it doesn't work, It just make the same action over and over. Here's...
Read more >CS 105 | exercise13
Now that we have the clone behavior sorted, we can return to the main Ground script and add some blocks to spawn new...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m pretty strongly in favor of the first idea there! It lets you easily access a sprite and its clones together, which, thanks to treating sprites as first-class objects, is good for more complex programming concepts not easily possible in Scratch.
In order to match Scratch behavior without introducing more complex syntax, we would probably want to make
andClones
return the sprite as well as any of the clones made of it, and any clones of those clones themselves. (But, if you do(a clone).andClones()
, not clones of the parent/original sprite, IMO, since if you wanted to do that you’d just access the original object directly (this.sprites.whatever
).).andClones()
now exists (see #32), so we can move ahead with this.There are basically two things that need to happen:
.andClones()
in all uses of the touching block