@smsalv71 wrote:
Need help - struggling with event driven input.
I have a simple RPG tile game and for the sake of simplicity, I have 3 class objects - Game1.cs, Map.cs and Player.cs
Map contains all of the tile information and some tiles are "items" that can be picked up by the player and stored in inventory.
The problem is that the Player.cs contains input update logic (Update(GameTime gt)) and then will check if they come across an item. If they do come to an item, I would like to have the game prompt them if they want to pick it up or not (basically yes/no).
I can easily change the state management to display the dialog box and wait for input but how do I (or you) handle updating the logic within the Player.cs?
I can somewhat do this with flags, etc but not without writing a lot of spaghetti code, I don't know how to properly WAIT for the user to press Y or N and then continue.
I essentially need the game to STOP and wait for the user to select something BEFORE continuing the game loop but it is not working out for me.
My community friends, how do you handle displaying a question to the end user from a game object that is outside the Game class?
Much appreciated for any insight or point in the right direction.
Thank you!
Posts: 3
Participants: 2