This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2013-01-08 21:54:42

kucirchl
New Scratcher
Registered: 2013-01-08
Posts: 1

How can I make a sprite disappear when it touches another sprite?

How can I make a sprite disappear when it touches another sprite?
Is this possible when they are both moving towards each other?

Offline

 

#2 2013-01-08 22:27:22

technoguyx
Scratcher
Registered: 2008-10-18
Posts: 1000+

Re: How can I make a sprite disappear when it touches another sprite?

It is possible, absolutely. Assuming you only want to check against one specific sprite, you can simply use a "wait until" block with the condition:

when gf clicked
show
wait until <touching [Sprite2 v]?>
hide

Last edited by technoguyx (2013-01-08 22:27:44)


http://getgnulinux.org/links/en/linuxliberated_4_78x116.png

Offline

 

#3 2013-01-09 01:58:46

iNKGaming
New Scratcher
Registered: 2012-07-18
Posts: 18

Re: How can I make a sprite disappear when it touches another sprite?

Yes, just make sure the sprites do touch (I.E. They're not moving 50 steps per block and might not collide). The above suggestion is good (Using a wait until block) but if you only want the sprite hidden when touching and showing otherwise, use an if/else block inside of a forever loop.

Happy scratching,
- iNK

Offline

 

#4 2013-01-09 05:17:42

BLU_Spy
Scratcher
Registered: 2012-01-05
Posts: 1000+

Re: How can I make a sprite disappear when it touches another sprite?

As suggested above:

when gf clicked
forever
if <touching [Sprite2 v]?>
hide
else
show
end

Last edited by BLU_Spy (2013-01-09 05:18:04)


I HAVE SWITCHED ACCOUNTS! My new username is NoxSpooth.

Offline

 

#5 2013-01-09 06:32:41

ethwok
Scratcher
Registered: 2012-09-10
Posts: 100+

Re: How can I make a sprite disappear when it touches another sprite?

And if you're going to do the wait until touching sprite 2, make the movement in another script


http://displaypicks.com/wp-content/uploads/2013/01/Animals-12.jpg
I AM ETHWOK

Offline

 

#6 2013-01-10 01:57:55

Aditya007
Scratcher
Registered: 2012-11-27
Posts: 63

Re: How can I make a sprite disappear when it touches another sprite?

when gf clicked
show
forever
   if <touching [Sprite 2 v]?>
       hide
   end
end

Last edited by Aditya007 (2013-01-10 01:58:41)


Wolf_OS!!!  smile  Check My Stuff  tongue  Need Help?  Currently, I am http://blocks.scratchr.org/API.php?user=Aditya007&amp;action=onlineStatus&amp;type=square
http://i49.tinypic.com/15gy1j6.jpg

Offline

 

Board footer