Discuss Scratch

Adromeda13
Scratcher
14 posts

Is there a "if *=*" script?

I'm trying to make a game for Christmas and I need to figure out how to do something like “If backdrop=2, show, if else, hide” but I can't find anything like that. Please help! Oh yeah, this is for a chest sprite and I can't have it showing in the beginning.
mmate
Scratcher
19 posts

Is there a "if *=*" script?

Create a variable called backdrop.
if <(backdrop) = [2]> then
show
end
if <not <(backdrop) = [2]>> then
hide
end
I made a project, where you can test it:
http://scratch.mit.edu/projects/38306992/
Look at the code and test it!

Good luck for the Christmas game!

Last edited by mmate (Dec. 8, 2014 20:17:01)

lcb01
Scratcher
43 posts

Is there a "if *=*" script?

Another way to do it, which would be easier, would be:

when gf clicked
forever
if <(backdrop name) = (example)>
show
else
hide

An easier way to do this would be “if backdrop name = ”so-and-so“. Or, just ”if example = “#”. However, I'm still new to making these scratch block things in forums, so I illustrated with the example above.

Last edited by lcb01 (Dec. 8, 2014 20:27:49)

drmcw
Scratcher
1000+ posts

Is there a "if *=*" script?

Another way is
when green flag clicked
hide

when backdrop switches to [backdrop 2 v]
show

10 !
ScratchVaders or Galaga?
Maybe Eliza can help you decide?
Adromeda13
Scratcher
14 posts

Is there a "if *=*" script?

Thanks guys! I always didn;t know what the green was for!
Adromeda13
Scratcher
14 posts

Is there a "if *=*" script?

Oh yeah, I have another quick question:

Is there a way to put. if sprite1 touching sprite2, sprite3 show?
stickfiregames
Scratcher
1000+ posts

Is there a "if *=*" script?

You have to use a broadcast:
if <touching [sprite2 v]?> then //put this in sprite1
broadcast [show sprite3 v]
end

when I receive [show sprite3 v] // put this in sprite3
show

or a variable:
forever // put this in sprite1
set [touching v] to <touching [sprite2 v]?> // this sets it to true or false
end

forever // put this in sprite3
if <(touching) = [true]> then
show
else
hide
end










If you can read this, my signature cubeupload has been eaten by an evil kumquat!




or you just used Inspect Element, you hacker

;
79brue
Scratcher
24 posts

Is there a "if *=*" script?

Like
if <(backdrop name) = [2 ]> then
show
else
hide
end
Adromeda13
Scratcher
14 posts

Is there a "if *=*" script?

Thanks again, guys! I should be good for now, now.

Powered by DjangoBB