I would like to know if tagging sprites is possible. In other words, checking for collisions with any sprite with a certain tag. This would help a lot.
For instance:
If touching: Sprites tagged with "Wall"
Hope I make sense
Offline
Yes, it's possible, like this:
if <<<<touching [wall1 v]?> or <touching [wall2 v]?>> or <touching [wall3 v]?>> or <touching [wall4 v]?>> //All of your wall sprites whatever end
Last edited by SciTecCf (2012-06-19 10:51:43)
Offline
I meant a way that would take less space and time. Thanks though!
Offline
You could name all of your sprites "name" #. Then use this script (idk if it'll show up correctly though):
forever set [name v] to (0) repeat (length of [names v]) //make a list with all the possible names change [name v] by (1) set [# v] to (0) repeat (5) //or whatever number of sprites each tag has change [# v] by (1) if <touching (join (item (name) of [names v]) (#))?> broadcast (name) //Have a "When I receive" for each tag end end end
Last edited by AtomicBawm3 (2012-06-19 11:50:38)
Offline
AtomicBawm3 wrote:
You could name all of your sprites "name" #. Then use this script (idk if it'll show up correctly though):
forever set [name v] to (0) repeat (length of [names v]) //make a list with all the possible names change [name v] by (1) set [# v] to (0) repeat (5) //or whatever number of sprites each tag has change [# v] by (1) if <touching (join (item (name) of [names v]) (#))?> broadcast (name) //Have a "When I receive" for each tag end end end
I don't think the
<touching (join (item (name) of [names v]) (#))?>is possible.
Offline
It is, I just tried it. Just like Broadcast (join (blah|blah)) works too.
Offline
AtomicBawm3 wrote:
You could name all of your sprites "name" #. Then use this script (idk if it'll show up correctly though):
forever set [name v] to (0) repeat (length of [names v]) //make a list with all the possible names change [name v] by (1) set [# v] to (0) repeat (5) //or whatever number of sprites each tag has change [# v] by (1) if <touching (join (item (name) of [names v]) (#))?> broadcast (name) //Have a "When I receive" for each tag end end end
I KNEW IT! Lists ARE the answer!
Offline