So I have sprites checking to see if they're touching any of the other sprites on a list of those sprites. That works fine, but I can only check if I'm touching ANY of those list items, I can't tell which item it is once I know it's touching any of those items.
Is it possible to do this in the same script that checks the whole list, or no?
Offline
Yes it is. First so you know, any means a random one. Use a variable called listscanner which is initially set to 0. Have something like:
set [listscanner v] to (0) repeat until <(listscanner) = (length of list [list v])> change [listscanner v] by (1) if <touching (item (listscanner) of [list v])> set listscanner to (length of [list v]) other scipt end end
Offline
shadowmouse wrote:
Yes it is. First so you know, any means a random one. Use a variable called listscanner which is initially set to 0. Have something like:
set [listscanner v] to [0] repeat until <(listscanner) = (length of (list v)> change [listscanner v] by [1] if <touching (item (listscanner) of [list v])?> set [listscanner v] to (length of [list v]) other scipt end end
scratchblocks fixed.
Offline
sodaLA wrote:
shadowmouse wrote:
Yes it is. First so you know, any means a random one. Use a variable called listscanner which is initially set to 0. Have something like:
set [listscanner v] to [0] repeat until <(listscanner) = (length of (list v))> change [listscanner v] by [1] if <touching (item (listscanner) of [list v])?> set [listscanner v] to (length of [list v]) other scipt end endscratchblocks fixed.
now they're fixed.
Offline
sodaLA wrote:
sodaLA wrote:
shadowmouse wrote:
Yes it is. First so you know, any means a random one. Use a variable called listscanner which is initially set to 0. Have something like:
set [listscanner v] to [0] repeat until <(listscanner) = [length of (list v)]> change [listscanner v] by [1] if <touching (item (listscanner) of [list v])?> set [listscanner v] to (length of [list v]) other scipt end endscratchblocks fixed.
now they're fixed.
now they are
Offline