Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Help with clone collision scripts - differentiating between clones on contact
- MiaPie
- Scratcher
59 posts
Help with clone collision scripts - differentiating between clones on contact
I'm making an RPG dungeon-crawler-esque game, and I already have a few of the basic functions pegged. However, both the floor tiles and the wall tiles are in the same sprite. Is there any way to detect whether the player is touching a WALL, and not a FLOOR tile, if they are the same sprite?
I would prefer something that retrieved the costume name to something that retrieved the costume number, but I would be happy with either. And I do not want an answer that involves color blocks. If anyone knows a solution, that would be extremely appreciated.
when green flag clicked
forever
if <<touching [TERRAINELEMENTS v] ?> and <([costume name v] of [clone of TERRAINELEMENTS this sprite is touching v]) = [WALLTILE]>> then
stop moving the player
end
end
I would prefer something that retrieved the costume name to something that retrieved the costume number, but I would be happy with either. And I do not want an answer that involves color blocks. If anyone knows a solution, that would be extremely appreciated.
⁂⁂⁂
- drmcw
- Scratcher
1000+ posts
Help with clone collision scripts - differentiating between clones on contact
Put the detection in the clones. They know what type they are and if they are touching the player sprite.
- MiaPie
- Scratcher
59 posts
Help with clone collision scripts - differentiating between clones on contact
Oooh, good idea. So, if I want the player to stop when they're touching the wall, I'd use some kind of broadcast? Or zero out the velocity? Hmm… Thank you!!!
⁂⁂⁂
- Discussion Forums
- » Help with Scripts
- » Help with clone collision scripts - differentiating between clones on contact