Hi,
I am trying to make a very simple random generated 2D map for players to navigate their movement through a level. I have done this several times before but it was about 3 years ago and for the life of me I can not get this bloody thing to work how I want it to work.
I have a widget with an empty grid component, when the widget is created (which it is on level load) it creates an array of X number of items. I then loop through said array and create a “custom user widget” in row X Column Y. This works perfectly as intended.
Now the part I am struggling with, I have made all the buttons inactive because I want this grid of buttons to represent a “dungeon” so players should only be able to move from their current room to an adjacent room. So When I loop through the array I set a variable within the “custom user widget” called room number with the array index. So each “button” knows what room number it is. (starting at room 1) The player will start in a starting position of 0,0 (top left) so I only want 0,1 to be activated. (which I have working) When I press on room 1 what should happened is the room to the right (room 2) should become active, the room below should become active lets say room 6. Then if I click on room 2 room 6 should deactivate and room 7 should become active as should room 3.
The player’s current room is being tracked in another variable, which is updated every time the player presses on a room button.
What is weird is the code I had, worked for the first instance…so I loaded in and room 1 and 6 were lit up…(as player is at 0) allowing me to go right or down…however when I press the button and update my location nothing changes in the other buttons…I have run the code while pressing the buttons and I watch the life and it goes all the way through to enabling the button but doesn’t enable it.
So after like a 6 year pre amble my actual question, does anyone have a fool proof design for this type of grid movement system? As I have 4 maps to design and get done and I am 2 days in on this one piece a very large project.
It is a short single player game so I want the map to be random to add some sort of replayabilty to it, so I need control over what each room is (what each button does when you press it) to allow the player some agency over what path they take to the level boss, but also offering some challenge/hard decisions.
Any help greatly appreciated.