Loops

00george

  • Posts: 161
Hi im having problems with loops in my game I want the loop to happen then a couple of other blocks then the loop to happen again. It will make more sense in the picture. Basicily i want loop to happen then I want it to set x to 0 then loop again.

Hectate

  • *
  • Posts: 4643
Option 1: Duplicate the loop and everything in it and just throw it below the first loop with your "set X to 0" block between.

Option 2: Make your loop happen inside a custom block and just put that in there twice instead?

Option 3: Add a loop inside your loop?
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

Nomosoft

  • Posts: 122
Well, first of all, X never changes in this code. Once you set it to 0, it stays 0, so I don't know why you want to set it to 0, again. I'm not really sure what you want to do, here. If you don't change Y, but you reset X, you'll just draw back over the same spot, again.

Anyway, if you want the loop to happen twice, just put it in another loop, like so:

Do 2 times {
  Your original loop...
  Set X to 0;
}

Hectate

  • *
  • Posts: 4643
Nomosoft is correct: nothing changes X in that code.

Nice catch, I hadn't even considered if it would or wouldn't be necessary  :o
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

00george

  • Posts: 161
I didnt mean x sorry I mean XBottomOfScreen needs to be reset.

Hectate

  • *
  • Posts: 4643
Go with option 1 then, with the other attribute though.
Option 1: Duplicate the loop and everything in it and just throw it below the first loop with your "set X to 0" block between.

Option 2: Make your loop happen inside a custom block and just put that in there twice instead?

Option 3: Add a loop inside your loop?
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.