Discuss Scratch

parq
Scratcher
7 posts

Get background to change when two sprites touch

Hi community,
I'm working on a project on scratch and I'm trying to get a backdrop to change when two sprites on screen touch each other. I've coded the backdrop to change and each sprite as well but it doesn't seem to work. I've been using broadcast to try to get it done with no luck. I think I'm missing something. Can someone help me out?

Note: I'm a starter with no previous experience with programming.

Thanks in advance,
powercon5
Scratcher
1000+ posts

Get background to change when two sprites touch

in one sprite put

when green flag clicked
forever

if <touching [sprite 2] ?> then
switch backdrop to [2]
end

end
parq
Scratcher
7 posts

Get background to change when two sprites touch

Hi powercon5,

i tried your solution but it didnt work for me.
i currently have these blocks on my sprite (cant upload a pic atm):

when backdrop switches to <1>
show
if <touching clock> then
switch backdrop to <2>
else
forever
show
go to <mouse pointer>
hide

thanks
powercon5
Scratcher
1000+ posts

Get background to change when two sprites touch

parq wrote:

Hi powercon5,

i tried your solution but it didnt work for me.
i currently have these blocks on my sprite (cant upload a pic atm):

when backdrop switches to <1>
show
if <touching clock> then
switch backdrop to <2>
else
forever
show
go to <mouse pointer>
hide

thanks
if you share it I could have a look at the script
dhdguysg
Scratcher
100+ posts

Get background to change when two sprites touch

parq wrote:

Hi powercon5,

i tried your solution but it didnt work for me.
i currently have these blocks on my sprite (cant upload a pic atm):

when backdrop switches to <1>
show
if <touching clock> then
switch backdrop to <2>
else
forever
show
go to <mouse pointer>
hide

thanks
Easy, Put this into the sprite
when gf clicked
forever
if <touching [ sprite that you want v] ?>
//TO-DO: Insert the code you want to happen here
end
end
parq
Scratcher
7 posts

Get background to change when two sprites touch

powercon5 wrote:

parq wrote:

Hi powercon5,

i tried your solution but it didnt work for me.
i currently have these blocks on my sprite (cant upload a pic atm):

when backdrop switches to <1>
show
if <touching clock> then
switch backdrop to <2>
else
forever
show
go to <mouse pointer>
hide

thanks
if you share it I could have a look at the script


i shared the project for viewing purposes. You can check it out at my profile.

Let me know what you see.
Catsarefun
Scratcher
57 posts

Get background to change when two sprites touch

when green flag clicked
show
switch backdrop to [backdrop1 v]
forever
if <touching [Sprite2 v] ?> then
switch backdrop to [backdrop2 v]
hide
broadcast [hide the other sprite v]
end

end
This should work, parq!
Christians_Games
Scratcher
10 posts

Get background to change when two sprites touch

when green flag clicked
forever

if <touching [sprite2 v] ?> then
switch backdrop to [backdrop2 v]

end

end
gadgetguy2006
Scratcher
79 posts

Get background to change when two sprites touch

i need help getting the sprite to be able to move while jumping in a platformer

Last edited by gadgetguy2006 (Feb. 7, 2016 11:40:48)

Paddle2See
Scratch Team
1000+ posts

Get background to change when two sprites touch

gadgetguy2006 wrote:

i need help getting the sprite to be able to move while jumping in a platformer
Please make your own topic in this section - look for the New Topic button in the upper right hand area of the screen when you are on the main directory

https://scratch.mit.edu/discuss/7/

Or, you can click this link

https://scratch.mit.edu/discuss/7/topic/add/

Powered by DjangoBB