Skip to content
← Back to Community
How to make random dungeons room
Profile icon
GorillaYT

Hello!
I am trying to make a random dungeon room.
So in the random function it does a 50/50 chance thing.
I want to make a random room where certain objects are in there.
I use bool.
So here how i want to work but i don't know what to do.
Make bool; like bool monster
Use a random function to determine if this new object / dungeon room will have this thing. So I use random function so if its 1 it will make bool monster true. So because it's true when u enter room there will be monsters

Answered by Coder100 [earned 5 cycles]
View Answer
Voters
Profile icon
CaspianSmuts
Profile icon
GorillaYT
Comments
hotnewtop
Profile icon
Coder100

why a bool when you can use an int and have your dungeons be like:

std::string dungeons[][] = { { "A", ".", ".", ".", "A" }, // A could be like a wall and . could be nothing };

and then to draw just loop through the array.

Profile icon
GorillaYT

@Coder100
THANK YOU. (:

Profile icon
Coder100

no problem :D @GorillaYT