[solved] Loop not working :(

Newbie here. And stuck!

What I want to do?
When I press the spacebar, I should generate 10 random bottles placed 32 px apart.

What does the code look like?

(Screenshot attached)

What logic I’m using?
Variables “SizeX” and “SizeY” are the numbers of “bottles” along X and Y axis respectively.
When variable “Looping” is true, it should progress the loop along X and then Y direction.

What’s the output?
Unfortunately, a blank screen!

Please help!

Are the objects in the group and is the spelling and capitalization the same?

1 Like

Blank as in a pitch black screen that is completely broken?

1 Like

Is the x>variable line supposed to be a subevent? it only works now if y > the variable

I think it’s stuck in the loop. Frozen.

1 Like

Hey @Keith_1357 Thanks for the useful comment. I checked the variable and object spellings. Seems they were right.

@Lucky-j The screen goes black after a few seconds. Is that a stuck loop?

Yep my friend. I know because I am somewhat of an expert at making stuck loops.


You’re increasing x but not checking it unless y > variable but you’re not increasing y So, it’s just goes on forever.

1 Like

Thanks @Keith_1357 and @Lucky-j
I see the problem now! Your inputs helped me a lot!

do something
x + 1
if x > variable then
    y +1
if y > variable 
     set looping = false
1 Like