Hey SpencaSlim!
Here is the code I made up in my last revision before being sidetracked to my certification:
Put it in a controller object with it being fired on create event.
///Generate level
TILESIZE = 16;
randomize();
var sizeX = room_width / TILESIZE;
var sizeY = room_height / TILESIZE;
//Set starting position, excluding the borders
var startX = irandom_range(1, sizeX-1);
var startY = irandom_range(1, sizeY-1);
var cells;
for(y=0; y < sizeY; y++)
{
for(x = 0; x < sizeX; x++)
{
cells[x, y] = "1";
}
}
var dir = direction;
repeat(2500)
{
if (scrChance(50))
{
dir = choose(90,270,180,0);
}
//Choose a direction at random
switch(dir)
{
case 90:
startY--;
break;
case 270:
startY++;
break;
case 180:
startX--;
break;
case 0:
startX++;
break;
}
//If we are going to a border, retreat
if (startX < 1) {startX = 1};
if (startY < 1) {startY = 1};
if (startX >= 49) {startX = 48};
if (startY >= 37) {startY = 36};
//Mark this array position as free
cells[startX, startY] = "0";
var ground = instance_create(startX * TILESIZE, startY * TILESIZE, objGrass);
///Choose a random sub-image for added variety
ground.image_index = choose(0,1,2);
//Do not animate
ground.image_speed = 0;
}
Like I wrote previously, I just went on and placed my player on the first "0" array cell. And my exit point at the last "0" cell. Enemies, just get a few random "0" positions and drop them there.
Any morequestions, just let me know. Cheers.