Help! Objects not becoming invisible

helpwithcode

#1

I am making a fruit ninja game, and you only have a certain amount of time to get all the fruit. I’m having a problem: when time runs out, all the fruit should disappear. But it’s not working!

Here's the code telling the fruit to disappear when time is done:

Anyone have an idea of why this isn’t working properly? THANKS!!!!


#2

Hmm, can you show me the code where it is setting Time to 0?


#3

I think I know what is happening. I have this problem with one of my new projects that I'm working on. Because when the project is started, all values are set to 0, which means some blocks read this before other blocks set the values etc. Maybe you could change it to 25, so when Time Time = 25, set invisibility percent 100. The other way you could do this is if you have a 'when the play button is pressed', have a 'repeat forever' block having a 'check once else' in it. Have check once if Time Time = 25, then set invisibility to 100. In the 'else' section, put 'set invisibility to 0'.

Hope this helps, I'm not sure since I do not know how you got this command to work. Give it a try!

Update: never mind, misread what you said. But this may be helpful for someone else.


#4

The when is only checked once.
With check once ifs around the set invisibility to 0,they will be invisible when time is up.


#5

Hi, you could place a large _ along the bottom or sides of the screen. make a wait command to whatever time you want,then have the _ become invisible. start the fruit as invisible and become visible when touching the _ . When the wait time is over the _ will dissapear and the fruit will remain invisible as they can't touch the _ anymore. Hope this gives you some ideas.


#6

I thinks there's a simple fix and that's to put a 'Check Once If' block around the blocks in the repeat forever. In the'Check Once If' bubble put 'Time not equals 0'.


#7

I know why! All that code you put in the repeat forever block, put a check once if block. Check once if Time bigger than 0. Take all that code you put in the repeat forever block, and put it in the check once if block. Make sure the check once if is in the repeat forever block.


And you should be done!


#8

Wow @Madi_Hopscotch_ you are always ready to help!

Good job helping the community!