Help! Code Backfired

help_me_please

#1

I’ve created a new project and wanted to include a try again button which would go back to the start. To do this I wanted to use variable / phases so each tap or whatever will move to the next phase and the try again button would take me back to first phase however when I changed everything to include the phases it didn’t work and now for some reason the objects I’ve named wave won’t appear, there’s also too much rain now in acid rain mode.


#2

That seems like some big errors. But don’t worry, you are in the right place! I have taken a look at your code, and I see that the rain increased heavily after a while playing the “Acid rain” mode. For the stop screen, I think that you first have to fix the “time played” counter so that it increases the “seconds” value instead of decreasing it.

I also think that you should take a look at your “Clone machines” and see if you can change the random() blocks to a higher number.

If this doesn’t work or if you need more help, don’t hesitate to ask me by tapping the “Reply” button to the left under this text!


#3

What do you mean by stop screen?
I’ve changed the clone machines and made both values on the wait block bigger which made it longer for it to take over the screen and cloud it but it still does so and as I understand it clones it to the point that the game crashes and will no longer make Rain.
However I think the problem lies within the variables as the Acid Rain Mode was working fine before I changed everything to add the try again button.
I still have no idea why the waves which are supposed to show up at the ends of the platform aren’t appearing and why when you tap Acid Rain Mode or Original Mode the text move to the top of the screen instead of just moving up by the numbers shown in their change in y blocks which are too small for it to escalate to that point.
Thanks for replying. Any suggestions to fix these problems?


#4

I mean the screen when you lose when I am talking about the “stop screen”. That was really bad written by me, sorry. I’m not really the best at looking at other’s code and troubleshooting it, but there are some really amazing people here which are great help. Those include @ThinBuffalo, @BlastFusion and others. Wait a bit and see if the two persons I tagged above will reply.


#5

First of all: Try and get the instructions in the front of the screen. It should be pretty easy


Second: This is a terrible way to create clones. It’s most likely what leads to the excessive lag and rain in acid mode. Try reusing a hundred or so clones instead of creating 4000.

I couldn’t figure out how to lose so I can’t help you with the reset thing.


#6

Hi @Revilo

Try temporarily adding this code

It’ll use the All Values object to display the number of objects you’ve created. The most Hopscotch can create is 4096 (but the performance will suffer long before the limit is reached).

You’ll see that the number of objects increases quickly to the maximum limit.

This is because you have these 2 Conditional events:


that, as Nindroid showed above, start creating lots of clones in Repeat Forever loops (which will always cause problems as the number of clones increases).

Also, it’s important to understand that it’s not just the original object that’s running these rules. All clones of the object run these events too. So then you get clones creating clones. And then clones of clones creating clones. This makes the number of objects increases exponentially (really fast).

I’m not sure what the :iphone:# variable is supposed to represent, but

  1. Don’t create clones in a Repeat Forever loop
  2. Don’t use When rules that continually create clones

#7

They explained it right
And welcome to the forum!


#8

Thanks for your help guys!
I’ve changed it to only create 100 clones as @Petrichor suggested and it’s working better now.
@ThinBuffalo the :iphone:# is the score/timer so the two conditionals were supposed to increase the difficulty as time went on and make more rain.
You lose when you bump into the waves or the rain drops but I had only made drown ( bumping into waves ) when I posted this.