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

#1 2013-03-07 15:09:11

tinytowers
New Scratcher
Registered: 2013-03-07
Posts: 7

Make something disappear? HELP WITH WORK!

Hi everyone. I am in a computer science class, and I am trying to make a maze game in scratch (not a scary one, mind you all!), and I am trying to make something happen. At the end of the maze, there is a wall blocking off the exit to the outside of the maze. When the player (a tiny black square) hits another sprite located somewhere in the maze, the wall at the end should be gone, not just hidden, but gone. I do not want to get rid of the script completely, I just need something that will temporarily get rid of the wall and it's code. Any help would be greatly appreciated. Thanks!

Offline

 

#2 2013-03-07 15:18:00

CAA14
Scratcher
Registered: 2013-01-14
Posts: 1000+

Re: Make something disappear? HELP WITH WORK!

Well, if you post your scripts, i could help you better, as i do not know the whole situation. Sounds like you need a Boolean variable.

Regards,

CAA14

Offline

 

#3 2013-03-07 15:19:20

ChadtheBuilder
Scratcher
Registered: 2013-02-27
Posts: 100+

Re: Make something disappear? HELP WITH WORK!

You should do something like this

When sprite 1 touches sprite 2
      broadcast (hide)

Now on the objects code that is to be hidden, add this.

When I receive (hide)
      Hide.


Sorry I could not give a better visual representation. I can't get scratch block a to work.


http://dl.dropbox.com/u/107729333/1360160765356.jpg

Offline

 

#4 2013-03-07 15:27:08

tinytowers
New Scratcher
Registered: 2013-03-07
Posts: 7

Re: Make something disappear? HELP WITH WORK!

CAA14, I don't actually have any code for this part. I just need to know the code, as it is for homework. If you have any ideas for this from what I have said previously, go right ahead. Thanks.

Offline

 

#5 2013-03-07 15:34:35

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: Make something disappear? HELP WITH WORK!

Well, if you need the actual code, I don't think we should be helping you, because it's considered cheating.


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#6 2013-03-07 15:45:04

tinytowers
New Scratcher
Registered: 2013-03-07
Posts: 7

Re: Make something disappear? HELP WITH WORK!

Sorry, new here, don't get the logistics of scratch and what not... Sorry! I think I have a solution but if you guys could just tell me if it could work that would be great...

I think I should use a

[x position] of [Sprite1]
And also a

[y position] of [Sprite 1]
so that when my character gets to the exact x and y coords it gets rid of the wall at the end. Would that work?

Offline

 

#7 2013-03-07 15:58:21

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: Make something disappear? HELP WITH WORK!

No, because then it would have to be to the exact pixel.
Try if touching sprite 1.


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#8 2013-03-07 16:00:50

tinytowers
New Scratcher
Registered: 2013-03-07
Posts: 7

Re: Make something disappear? HELP WITH WORK!

Thanks! I'll try that and post back with what happens! Thanks everyone for helping me out!

Offline

 

#9 2013-03-07 16:13:30

tinytowers
New Scratcher
Registered: 2013-03-07
Posts: 7

Re: Make something disappear? HELP WITH WORK!

Hmmm... Still not working... I put in a

when gf clicked
if touching sprite4
broadcast hide
(sorry for no blocks)

and still nothing. Now what? I am completely clueless on what to do.

Offline

 

#10 2013-03-07 17:18:41

echristophy
New Scratcher
Registered: 2013-02-28
Posts: 17

Re: Make something disappear? HELP WITH WORK!

That code only hides the wall if you click on the green flag if at that moment the two sprites are touching. If I understand you correctly, what you want is for the wall to hide when the two sprites touch. How about this:

When gf clicked
Wait until touching sprite4
broadcast hide

then the wall will hide when the two sprites touch.

(I think. I'm new at this too)

Offline

 

#11 2013-03-07 17:29:44

CAA14
Scratcher
Registered: 2013-01-14
Posts: 1000+

Re: Make something disappear? HELP WITH WORK!

Yes, you need to have that in a forever loop, like this:

when gf clicked
forever
if <touching? [Switch v]>
broadcast [hide wall v]
stop script
end
end

That should work.

Hope that helps,

CAA14

Offline

 

#12 2013-03-07 18:13:53

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: Make something disappear? HELP WITH WORK!

However, the wall needs the when I receive hide, hide script.


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#13 2013-03-07 18:18:34

CAA14
Scratcher
Registered: 2013-01-14
Posts: 1000+

Re: Make something disappear? HELP WITH WORK!

Yes, of course.

when i receive [hide wall v]
hide
^ That would go in the wall that you want to make disappear.

Regards,

CAA14

Offline

 

#14 2013-03-08 12:05:11

tinytowers
New Scratcher
Registered: 2013-03-07
Posts: 7

Re: Make something disappear? HELP WITH WORK!

Hey, thanks everybody, I will try this out, and thanks for all the help! I'll post back in a few minutes!

Offline

 

#15 2013-03-08 12:11:31

tinytowers
New Scratcher
Registered: 2013-03-07
Posts: 7

Re: Make something disappear? HELP WITH WORK!

Yay! It works, thanks so much everybody! This helps me out so much! Thanks again!

Offline

 

#16 2013-03-08 12:32:18

CAA14
Scratcher
Registered: 2013-01-14
Posts: 1000+

Re: Make something disappear? HELP WITH WORK!

No problem, if you need anymore help, just ask.  smile

Regards,

CAA14

Offline

 

#17 2013-03-08 14:13:13

newnewfew
Scratcher
Registered: 2013-02-23
Posts: 68

Re: Make something disappear? HELP WITH WORK!

It should be this:
For the main sprite:

when gf clicked
forever if <touching [that sprite]>
broadcast [hide]
For "that sprite"
when i receive [hide]
hide
Hope this helps!


It's contest time!
http://scratch.mit.edu/projects/newnewfew/3218957

Offline

 

Board footer