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

#1 2011-07-18 23:57:10

DewleafWolf
Scratcher
Registered: 2011-01-13
Posts: 100+

A simple question! Please help?

This is very simple, probably anyone could help me with this.  smile

I'm making a game called The Ice Cream Maker where, well, you make your own ice cream. Okay, so first you select a cone. When you first select the one, you pick two scoop flavors and then drag toppings.
My question: once the player has dragged their desired toppings to the ice cream, how can I make the rest of the unchosen toppings disappear? Any ideas?

I could always make the toppings stay there and just make a title saying you're done, but you could still drag toppings... It would be much better if I could make all toppings that aren't on your ice cream disappear, so all you can see is your finished ice cream creation and the title.

Any help is appreciated!

Offline

 

#2 2011-07-19 00:06:44

Thescratch3
Scratcher
Registered: 2011-06-14
Posts: 1000+

Re: A simple question! Please help?

I know. Make a done button or something and make a variable called toppings. Set toppings to 0. For the script that allows the toppings to be added, say change toppings by 1 in that script. The done button, yes, say if When Flag Clicked forever if toppings = 0 or toppings > 0 and mouse down and touching mouse pointer broadcast done. For all the toppings say When i receive done hide.

This may or may not work. It would be much helpful with the game uploaded  sad .


View my projects. Or face The scratch curse! (Get it?)
http://i56.tinypic.com/2cdk8hy.png

Offline

 

#3 2011-07-19 00:35:53

TheBajeebas
Scratcher
Registered: 2010-04-26
Posts: 1000+

Re: A simple question! Please help?

On all of the topping sprites you want a script that is:
When green flag
forever
if
touching (icecream)
broadcast "hide toppings"
stop script

and also

when I receive "hide toppings"
hide


Hope that helps! If you need any questions just ask!  smile


http://i.imgur.com/jOkeD.jpg

Offline

 

#4 2011-07-19 02:10:25

jji7skyline
Scratcher
Registered: 2010-03-08
Posts: 1000+

Re: A simple question! Please help?

To stop the sprites from being able to be dragged, use the stop all block or hide them.


I don't know why you say goodbye, I say hello!  big_smile

Offline

 

#5 2011-07-19 12:05:03

Thescratch3
Scratcher
Registered: 2011-06-14
Posts: 1000+

Re: A simple question! Please help?

jji7skyline wrote:

To stop the sprites from being able to be dragged, use the stop all block or hide them.

Why stop all? That means to stop the game  tongue


View my projects. Or face The scratch curse! (Get it?)
http://i56.tinypic.com/2cdk8hy.png

Offline

 

#6 2011-07-19 15:00:17

DewleafWolf
Scratcher
Registered: 2011-01-13
Posts: 100+

Re: A simple question! Please help?

These are all helpful. I'll try each one and post the one that works the best for me! Thanks.

Offline

 

#7 2011-07-19 16:59:10

DewleafWolf
Scratcher
Registered: 2011-01-13
Posts: 100+

Re: A simple question! Please help?

@TheBajeebas :: Your scripts made perfect sense, though I changed "When flag clicked" to "When I recieve 'finished'". ('finished' is broadcasted by clicking the 'Done' button.)
The only problem with it, is when any toppings broadcast "hidetoppings" they also have the script "When I recieve 'hidetoppings - hide" so that ALL toppings hide, no matter what...

Is there some way to get around this? Some way to change the code so that "When I recieve 'hidetoppings' - hide" only affects unselected toppings?

@Thescratch3 :: I'll try your script next!

Offline

 

#8 2011-07-19 17:05:46

DewleafWolf
Scratcher
Registered: 2011-01-13
Posts: 100+

Re: A simple question! Please help?

YESSS!! Sorry for the excitement, but I figured it out! Ok, ignore the post above. Here is the script I created and worked perfectly:

When I recieve "finished"
forever if < not < touching Sprite40 > or < touching Sprite 5 > >
hide

In simpler terms, when the Done button is clicked and 'finished' is broadcasted, any toppings that are not touching the ice cream will hide.

Offline

 

#9 2011-07-19 17:06:04

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: A simple question! Please help?

DewleafWolf wrote:

@TheBajeebas :: Your scripts made perfect sense, though I changed "When flag clicked" to "When I recieve 'finished'". ('finished' is broadcasted by clicking the 'Done' button.)
The only problem with it, is when any toppings broadcast "hidetoppings" they also have the script "When I recieve 'hidetoppings - hide" so that ALL toppings hide, no matter what...

Is there some way to get around this? Some way to change the code so that "When I recieve 'hidetoppings' - hide" only affects unselected toppings?

@Thescratch3 :: I'll try your script next!

Hm... you could try setting a local variable like "placed" for each sprite to 0 by default, then if you have placed that sprite, set "placed" to 1 and modify the broadcast receiver hat block a little, like this:

Code:

When I receive hidetoppings
if placed = 0
    hide

Edit: Oops, never mind. Looks like you figured it out.

Last edited by Harakou (2011-07-19 17:06:41)


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/OZn2RD3.png&amp;link2=http://i.imgur.com/duzaGTB.png&amp;link3=http://i.imgur.com/CrDGvvZ.png&amp;link4=http://i.imgur.com/POEpQyZ.png&amp;link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#10 2011-07-21 00:43:14

Thescratch3
Scratcher
Registered: 2011-06-14
Posts: 1000+

Re: A simple question! Please help?

DewleafWolf wrote:

YESSS!! Sorry for the excitement, but I figured it out! Ok, ignore the post above. Here is the script I created and worked perfectly:

When I recieve "finished"
forever if < not < touching Sprite40 > or < touching Sprite 5 > >
hide

In simpler terms, when the Done button is clicked and 'finished' is broadcasted, any toppings that are not touching the ice cream will hide.

Nice job! Please let me know when you are done and give me the URL. Also click my sig!


View my projects. Or face The scratch curse! (Get it?)
http://i56.tinypic.com/2cdk8hy.png

Offline

 

#11 2011-07-22 15:44:05

DewleafWolf
Scratcher
Registered: 2011-01-13
Posts: 100+

Re: A simple question! Please help?

I will be sure to let you know when it's done! I'm almost finished with it; probably will be done in a day or two.

Offline

 

#12 2011-07-27 20:08:38

DewleafWolf
Scratcher
Registered: 2011-01-13
Posts: 100+

Re: A simple question! Please help?

The project is done! Go to my projects and try it out... I have a few others that are almost done. I know it has a few problems, but it's my first project that I've finished!  wink

Offline

 

Board footer