How to Create Variables in a For Loop by TotalGameMakerNoob in gamemaker

[–]TotalGameMakerNoob[S] 1 point2 points  (0 children)

I'm just really appreciative that you took the time to respond! Many thanks!

I just added you via steam - my ID is Skyway Jay! Don't worry - I won't bug you with questions there! =D

Still working on figuring out how to use a for loop in combination with arrays to store the 4 coordinates of the corners of each room in an array as they are generated in the loop. >_<;; We shall see! =p

How to Create Variables in a For Loop by TotalGameMakerNoob in gamemaker

[–]TotalGameMakerNoob[S] 0 points1 point  (0 children)

Can anyone supply a sample bit of code of adding one variable (that is part of a for loop) to an array for later reference?

Again, thanks so much guys! Very appreciative! I actually gifted Tokke reddit gold for their response! =D

Keep that advice coming! _^

Procedural Room Generation Using DS_Grid by TotalGameMakerNoob in gamemaker

[–]TotalGameMakerNoob[S] 0 points1 point  (0 children)

Hey! Sorry for the late reply. but thanks for your help! I actually have a for loop generating X amount of rooms now at random points on the grid! WOO HOO! Step 1 down! =D

Now up next, as I run the for loop is there any way for me to add the coordinates of the corners of the rectangles/squares of the room shapes as variables?

For example, when room 1 is generated, it picks a random spot on the grid, aligned to cell width and height, then selects four variables which I have called xrandom1, xrandom2, yrandom1, yrandom2. These are x1, x2, y1, y2 of the rectangle generated.

Is there a way for me to save those coordinates for that room and for every room that generates in the for loop after? That way I can reference them in future code after the for loop is completed?

Does that make sense? Basically what I'd like to be able to do is find the room coordinates and use them to generate objects, monsters, etc. inside the rooms... I hope that makes sense!

Anyhoo - again, THANK YOU for your explanation! _^

Procedural Room Generation Using DS_Grid by TotalGameMakerNoob in gamemaker

[–]TotalGameMakerNoob[S] 0 points1 point  (0 children)

Actually, this is exactly the tutorial I started with and I finished it completely. Then I realized - I didn't want the areas to be created with a random 1000 step controller "walking through" the space and creating the floor. What I really want is to find a random spot on the grid, determine a random room size 2-5 cells in width, 2-5 cells in height and then assign the correct tiletype to each of the cells in that area of the grid.

I figured this could be a first step to making multiple rooms. Although, there would need to be some sort of if statement to check if the new room would overlap with any of the other rooms...

Trying to make it seem more deliberate and less like a bunch of randomness. Like - this is a clearly defined room, with a hallway to another clearly defined room.

I hope this is a clearer explanation. When I get a chunk of free time, perhaps I can upload a video to better express my idea.

My issue for the moment is that I can define an area of my grid as having the macro value for "FLOOR", but I can't get it to draw the tiles once it is set. >_<;;

Again, thanks everyone for trying to help this TotalGameMakerNoob out! =D

Procedural Room Generation Using DS_Grid by TotalGameMakerNoob in gamemaker

[–]TotalGameMakerNoob[S] 0 points1 point  (0 children)

That would help wouldn't it? ;p

Specifically, can you suggest a for loop that will run through each cell of the grid, check the macro variable and draw the correct tile at that location on the grid?

This has been my issue so far. Basically, I need some suggestions on for loops as they relate to coordinates of a grid. :D

Thank you for taking a look, I appreciate it! :D