I'm trying to come up with a code to place a certain object in my game. As it is a mining game I need my dirt object to be placed in every square of my grid. My dirt object is 32X32 px. and when run over by digger it crumbles. My play field is 32000X32000. That's 1000X1000 squares, you see the problem here. I've tried coding to place them so I don't have to place all 1 million by hand and here is what I've come up with so far.
{
if xx < room_width-32 && yy < room_height-32
{
instance_create(0,0,object1);
xx += 32;
x = xx;
y = yy;
}
if xx = room_width-32 && yy < room_height
{
instance_create(0,0,object1);
yy += 32;
xx = 0;
x = xx;
y = yy;
}
if xx < room_width-32 && yy = room_height-32
{
instance_create(0,0,object1);
xx += 32;
x = xx;
y = yy;
}
}
The problem I run into with this code is it will create the object, move to the next square and create another, when it reaches the end of the row, it goes to the next row. Everything is fine until it gets to the last row. On the last row, it will only create the object in the first 2 spaces. I need it to create in all spaces. ANY help would be appreciated.



Find content
Male
