G
gamedev513
Guest
Hey guys,
I have a randomly generated dungeon that is created using different sprite indexes as a guide/blueprints that are different colors. Ive provided 2 generated levels (i.e. images below - every color is a different room that will have different things inside).
I'm trying to implement seed functionality similar to Minecraft or Binding of Isaac where a player can input a value and it will automatically return the same room setup every time. Note that the positions of the rooms/blueprints are static and do not change. I use arrays to store the sprite index values to be drawn and the amount of array indexes is based on the maximum value of blueprints/rooms allowed (how many rooms the level will have).
Hopefully someone can help me out?
Create event of obj_gen:
Draw event of obj_gen:
I have a randomly generated dungeon that is created using different sprite indexes as a guide/blueprints that are different colors. Ive provided 2 generated levels (i.e. images below - every color is a different room that will have different things inside).
I'm trying to implement seed functionality similar to Minecraft or Binding of Isaac where a player can input a value and it will automatically return the same room setup every time. Note that the positions of the rooms/blueprints are static and do not change. I use arrays to store the sprite index values to be drawn and the amount of array indexes is based on the maximum value of blueprints/rooms allowed (how many rooms the level will have).
Hopefully someone can help me out?
Create event of obj_gen:
Code:
randomize();
// Determine level we are on
switch(argument[0])
{
case 1: // Use Level 1 Blueprints
// Randomize max blueprints allowed
max_blueprint = irandom_range(7, 10);
for(i = 0; i < max_blueprint; i++)
{
blueprint_select = irandom(sprite_get_number(L1));
blueprint_array[i] = blueprint_select;
}
break;
default: break;
}
Code:
draw_set_alpha(1);
xx = room_width div 2;
yy = 0;
for(i = 0; i < max_blueprint; i++)
{
draw_sprite(L1, blueprint_array[i], xx, yy);
yy += 36;
}
Attachments
-
8 KB Views: 2
-
8.1 KB Views: 1