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

#1 2012-03-25 15:22:57

Phantom_yo
New Scratcher
Registered: 2012-03-25
Posts: 4

Sprites disappearing after a certain amount of clicks.

So far I have been able to fix any problems through other forum posts or videos but I am a bit stuck.

I am trying to display the amount of darts available to throw (6 in total). I have set up a variable for how many times the mouse is clicked and set it up so that the correct number of clicks should hide the corresponding dart on display but it os not working.

Here is the script



when gf clicked
if <(mouse clicked)> = [1]>
         hide
         end
end


and the game so far.

Offline

 

#2 2012-03-25 15:52:40

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Sprites disappearing after a certain amount of clicks.

when gf clicked
forever
wait until <not <mouse down?>>
wait until <mouse down?>
change [mouse clicked] by (1)
end
That should keep track of clicks.

when gf clicked
set [mouse clicked] to (0)
wait until <(mouse clicked) > (6)>
hide
will make the dart hide.


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#3 2012-03-25 16:56:58

Phantom_yo
New Scratcher
Registered: 2012-03-25
Posts: 4

Re: Sprites disappearing after a certain amount of clicks.

Worked great. Thank you.

Offline

 

#4 2012-03-25 17:27:10

Phantom_yo
New Scratcher
Registered: 2012-03-25
Posts: 4

Re: Sprites disappearing after a certain amount of clicks.

On another note - if you test the game, all balloons pop more or less true but the purple one pops very inconsistantly despite having the same script. Any ideas?

Offline

 

#5 2012-03-25 17:46:27

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Sprites disappearing after a certain amount of clicks.

The center of the purple balloon costume is pretty far away from the balloon, so the mouse is often further than 50 away, even when it is on the balloon.  Go to the costume and click "set costume center" and click the center of the balloon.  A few of your balloons' centers are off, so you should probably do the same to each balloon.

Last edited by MoreGamesNow (2012-03-25 17:46:47)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#6 2012-03-25 19:05:33

Phantom_yo
New Scratcher
Registered: 2012-03-25
Posts: 4

Re: Sprites disappearing after a certain amount of clicks.

Thanks. I tried looking for that feature but I couldn't see it. Little more persistance needed. I wondered why a few of them were more hit and miss. Double thanks.

Offline

 

#7 2012-03-26 12:13:19

Splodgey
Scratcher
Registered: 2011-04-26
Posts: 500+

Re: Sprites disappearing after a certain amount of clicks.

MoreGamesNow wrote:

when gf clicked
forever
wait until <not <mouse down?>>
wait until <mouse down?>
change [mouse clicked] by (1)
end
That should keep track of clicks.

when gf clicked
set [mouse clicked] to (0)
wait until <(mouse clicked) > (6)>
hide
will make the dart hide.

Better way: Also improves performance.

when gf clicked
set [mouse clicked v] to [0]
repeat until <(mouse clicked) > (6)>
wait until <not <mouse down?>>
wait until <mouse down?>
change [mouse clicked v] by (1)
end
hide

Last edited by Splodgey (2012-03-26 12:14:36)

Offline

 

#8 2012-03-26 14:27:15

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: Sprites disappearing after a certain amount of clicks.

Phantom_yo wrote:

Thanks. I tried looking for that feature but I couldn't see it. Little more persistance needed. I wondered why a few of them were more hit and miss. Double thanks.

Edit the costume, and you'll notice a button below the colors.   wink

Offline

 

#9 2012-03-26 16:36:18

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Sprites disappearing after a certain amount of clicks.

Splodgey wrote:

Better way: Also improves performance.

when gf clicked
set [mouse clicked v] to [0]
repeat until <(mouse clicked) > (6)>
wait until <not <mouse down?>>
wait until <mouse down?>
change [mouse clicked v] by (1)
end
hide

But there are multiple darts.  My second script can be copied into the darts, and the first script keeps track of the clicks.  Yours would need to include something similar to mine in all of the darts but one anyway (though yours is, admittedly, a bit more efficient for the dart that it is in).


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

Board footer