Discuss Scratch

testaccount477
Scratcher
2 posts

MAKING A "touching sprite and not touching this costume" BLOCK

hey every1!! im currently fixing bugs on my tower defense game. im trying to make a “not touching this costume” block so when a tower wont kill enemies before even being placed.

heres what i tried to do:

<touching darkball> <and> <not <touching (item 4 of debugcostume) > >

but absolutely nothing changed!!!!! if anyone knows how to fix this i'd appreciate it SO much
if not, ill just make a different sprite for each tower placement

ps. i dont really know how to post images in forums since the last time i used forums was in 2024

ThePaperMakers
Scratcher
48 posts

MAKING A "touching sprite and not touching this costume" BLOCK

The touching block doesn’t work with costumes. In the sprite that gets touched by the sprite you’re talking about you can make a variable that keeps track of the costume number / name. In your main sprite you can then check if that variable is a specfic value. You also do it using this block if you’re not working with clones:
([costume number v] of [Sprite 1 v])
ITS_DINO_XD
Scratcher
58 posts

MAKING A "touching sprite and not touching this costume" BLOCK

if <<touching [whatever] ?> and <([costume] of [ whatever]) = [the costume you want]>> then
whatever
end
Via-Hu
Scratcher
7 posts

MAKING A "touching sprite and not touching this costume" BLOCK

The best way I can think of for this problem is this:

Make a variable
(costume#)

In the costume sprite:
when green flag clicked
forever
set [costume# v] to (costume [number v])
end

Then when you want to check if it is touching this costume:
<<touching [(sprite with the costume) v] ?> and <(costume#) = [the costume number]>>

It will return true if it's touching the costume and false if it's not. If what you want is NOT touching then just add a
<not <>>
to it.

Hope this helps:)

Powered by DjangoBB