• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Random generation tower help?

V

vekopeko123

Guest
Hello, i want to make procedurally generated tower player has to climb on with this sort of patterns

I BBBBOOBBBBI
IOOOOOOOOOI
I BOOBBBBBB I
IOOOOOOOOOI
I BBBBBOOBB I
IOOOOOOOOOI
I BBBBOOBBBBI
IOOOOOOOOOI
I BOOBBBBBB I
IOOOOOOOOOI
I BBBBBOOBB I


I = border
B = block player can walk on
O = empty space

How would you approach making this and with what tools? Im thinking of making 20 "layouts" (those stripes of blocks) player can climb on and just let the game choose them randomly and place them. But what kind of code should i use for this? More precisellly, how would i write the code for it and with what functions?

Thank you for your help, i really appriciate it!
 

NicoFIDI

Member
If you know ds_grid, then you should be able to make your "presets rooms" in the Game start, or take them from a file.
Then with 2 for loops you skan the ds_grid and place It in the room.
After that you just need a trigger to place the Next room and the ammount of presets you have, so you know Witch you want using irandom
 
V

vekopeko123

Guest
If you know ds_grid, then you should be able to make your "presets rooms" in the Game start, or take them from a file.
Then with 2 for loops you skan the ds_grid and place It in the room.
After that you just need a trigger to place the Next room and the ammount of presets you have, so you know Witch you want using irandom
Yeah.... I don't know ds_grid :(
But thanks anyway! :D
 

Oakleaf

Member
Conversely, instead of adding blocks randomly, you could also delete blocks randomly. Create a fully-closed floor, and then choose a random x-position to delete block(s) from.

I suggest you look into for-loops when creating the floors.
You can get a random x-position using random();
 
Top