Y
YourGrandpa
Guest
Hey Gamemaker community,
as the title says i struggle with the create_instance_layer, i made some kind of loop with a counter but as soon one runs trough is complete it doubles the amount of objects created by it which wasnt intended.
Really tried to solve this on my own but i cant get my head around it just doubles. So i hope you guys and girls can help out.
// create event
xRandom = irandom_range(1,10)*32;
yRandom = irandom_range(1,10)*32;
counter = 0 ;
// step event
if(counter == 160){
// creating block at random position
instance_create_layer(xRandom,yRandom,"Instances",objGround);
counter = 0;
} else {
counter++;
show_debug_message(counter);
}
debug output
Entering main loop.
**********************************.
1
2
3
4
5
6
7
8
9
10
11
.....
1
1
2
2
3
3
4
4
5
5
6
6
7
7
8
8
9
9
10
10
...
as the title says i struggle with the create_instance_layer, i made some kind of loop with a counter but as soon one runs trough is complete it doubles the amount of objects created by it which wasnt intended.
Really tried to solve this on my own but i cant get my head around it just doubles. So i hope you guys and girls can help out.
// create event
xRandom = irandom_range(1,10)*32;
yRandom = irandom_range(1,10)*32;
counter = 0 ;
// step event
if(counter == 160){
// creating block at random position
instance_create_layer(xRandom,yRandom,"Instances",objGround);
counter = 0;
} else {
counter++;
show_debug_message(counter);
}
debug output
Entering main loop.
**********************************.
1
2
3
4
5
6
7
8
9
10
11
.....
1
1
2
2
3
3
4
4
5
5
6
6
7
7
8
8
9
9
10
10
...