Picking up objects in the game world which then allow a player to progress. Achieving this with switches and simple conditional statements!
So, I am continuing today to prototype the mechanics for my game. One thing I want the player to be able to do, is pick up objects and then have another event recognise that they are already holding the required item to progress. Creating a menu of items that a player can choose from and select ‘use’ seems cumbersome and creates unncessary steps for our player. Having said that, maybe a menu of items is still a good idea so that the player can at least refer to what they currently have in their inventory.
Using Global Switches, I managed to set the game into the state of ‘1’ after the player picks up (in this example) ‘a pot’. The ‘door’ a few steps away is expecting the game to evaluate to ‘1’ by the time the player interacts with it. If the event has not successfully evaluated to 1 - that is - the player has not picked up the pot… Then the event will evaluate to zero (false) and therefore the door will not open. A simple conditional check is responsible for this.
I’m not totally happy with this solution, as global switches are actually limited and feels like overkill for a simple moment in the game that only happens once. I tried Self Switches - but I couldn’t get the two events to talk to each other (since Self Switches are - of course - local to the one event they’ve been initialised in). Variables that can hopefully be accessed outside of the event would be a good move, so I’ll look into that.
I’m almost at the point where I can actually begin designing at least the first section of the game world outside of this prototype playground. Will be getting some footstep sounds put in first, the ability to load custom fonts and figuring out some kind of autosave function.