Discuss Scratch

ArianaCampbell
Scratcher
4 posts

How do i make something happen when one sprite TOUCHES another

I know how to make something happen when two sprites are constantly touching, but how do i make something happen when they touch ONCE?
ItBeJC
Scratcher
1000+ posts

How do i make something happen when one sprite TOUCHES another

I'm not sure what you mean exactly, but maybe something like this:
waituntiltouchingsprite?waituntilnottouchingSprite?. . . Runs the scripts you want to run when the sprites touch.
If you want this to happen all of the time, just put a forever loop around it.
deck26
Scratcher
1000+ posts

How do i make something happen when one sprite TOUCHES another

Do you mean they only touch once? You could do a wait until touching and then add the code (perhaps a broadcast) to make something happen.
cookieclickerer33
Scratcher
1000+ posts

How do i make something happen when one sprite TOUCHES another

If you want an “easy” and quick way to do it there’s always

whenthisspritetouchesmouse pointer

https://scratch.mit.edu/projects/916397939/

ArianaCampbell
Scratcher
4 posts

How do i make something happen when one sprite TOUCHES another

I mean like if you want the message “you died” to pop up after a sprite touches another sprite. I tried to do it with the when touching command but that makes it to where the message constantly glitches.
amogus1123
Scratcher
500+ posts

How do i make something happen when one sprite TOUCHES another

ArianaCampbell wrote:

I mean like if you want the message “you died” to pop up after a sprite touches another sprite. I tried to do it with the when touching command but that makes it to where the message constantly glitches.
example: https://scratch.mit.edu/projects/916446405/
i replicated what you said, it works fine.
conducter_kid
Scratcher
56 posts

How do i make something happen when one sprite TOUCHES another

amogus1123
Scratcher
500+ posts

How do i make something happen when one sprite TOUCHES another

conducter_kid wrote:

Please make constructive posts.
scratchcat_0001
Scratcher
3 posts

How do i make something happen when one sprite TOUCHES another

ArianaCampbell wrote:

I mean like if you want the message “you died” to pop up after a sprite touches another sprite. I tried to do it with the when touching command but that makes it to where the message constantly glitches.
maybe add a stop this script block?
whenclickedforeveriftouchingvthensomethingstop this script

Last edited by scratchcat_0001 (Oct. 31, 2023 09:14:52)

Master_-_Of_-_Code
Scratcher
7 posts

How do i make something happen when one sprite TOUCHES another

ArianaCampbell wrote:

I know how to make something happen when two sprites are constantly touching, but how do i make something happen when they touch ONCE?
Here's how I would do it:
waituntiltouchingTHE OTHER SPRITE?waituntilnottouchingTHE OTHER SPRITE?dosomething
ALSO I DO NOT HAVE 6 POSTS!

Last edited by Master_-_Of_-_Code (Oct. 30, 2023 22:04:20)

amogus1123
Scratcher
500+ posts

How do i make something happen when one sprite TOUCHES another

Master_-_Of_-_Code wrote:

ArianaCampbell wrote:

I know how to make something happen when two sprites are constantly touching, but how do i make something happen when they touch ONCE?
Here's how I would do it:
waituntiltouchingTHE OTHER SPRITE?waituntilnottouchingTHE OTHER SPRITE?dosomething
ALSO I DO NOT HAVE 6 POSTS!


This is the exact same as #2…
mixingbutterso
Scratcher
2 posts

How do i make something happen when one sprite TOUCHES another

aaa why is all things here like this was made in 2012 theres no wait until what do i do
aaaaaaaaaaa
mixingbutterso
Scratcher
2 posts

How do i make something happen when one sprite TOUCHES another

and everything else doesnt make sense!!!
CoolBanana019
New Scratcher
2 posts

How do i make something happen when one sprite TOUCHES another

#West_Virginia4life


can you make the message you died come up when 1 sprite touches another using REAL CODE PLEASE!!!!!!

#mad
#new_scracher
#not_a_code_master
CoolBanana019
New Scratcher
2 posts

How do i make something happen when one sprite TOUCHES another

WELLLLL?

#imPATIANT
BigNate469
Scratcher
1000+ posts

How do i make something happen when one sprite TOUCHES another

CoolBanana019 wrote:

#West_Virginia4life


can you make the message you died come up when 1 sprite touches another using REAL CODE PLEASE!!!!!!

#mad
#new_scracher
#not_a_code_master

CoolBanana019 wrote:

WELLLLL?

#imPATIANT
Please don't necropost. The people who responded to this probably haven't been looking at this for several months. Open your own topic instead.
Also, don't be rude. And, using the octothorpe (better known as a hashtag) to write #______ with off-topic things can be considered spam if it isn't in a signature.
LearnerYetCoder
Scratcher
10 posts

How do i make something happen when one sprite TOUCHES another

Maybe this?

whenclickedsettouching other spritetofalsewaituntiltouchingother sprite?settouching other spritetotruebroadcasttouching to other sprite onlystopthis script not really needed but meh

In the other sprite:

whenIreceivetouching only in the wanted spriteiftouching=truethen. . .settouching other spritetofalse
LearnerYetCoder
Scratcher
10 posts

How do i make something happen when one sprite TOUCHES another

touching=touchingothersprite*
Just correcting the touching variable.
dragonsnake003
Scratcher
100+ posts

How do i make something happen when one sprite TOUCHES another

ArianaCampbell wrote:

I mean like if you want the message “you died” to pop up after a sprite touches another sprite. I tried to do it with the when touching command but that makes it to where the message constantly glitches.
waituntiltouching?broadcastYOU DIED
RicDiamond1477
Scratcher
100+ posts

How do i make something happen when one sprite TOUCHES another

StLCC24FL wrote:

what you make no sens
Please don't post on discussions made and resolved a long time ago, this is called necropsying and redirects Scratchers from other Scratchers needing help.

Powered by DjangoBB