mardi 11 février 2020

Writing an if statement for the value in a dictionary

I'm taking an intro game design class and am writing a text adventure. I've set up a dictionary for the game map. For example:

"HALLWAY": { "name": "HALLWAY", "desc": "This is a hallway in a maze." "exits": [{ "exit": "NORTH", "target": "DEADEND" }], "items": []

Early on in the game you have the option to "TAKE" an item. IF the player has taken the item I want the target to be a different location (Not a dead end) ELSE the target is a dead end. How can I write the if/else statement into the value of the target? Or is there a more simple way of doing this?

Aucun commentaire:

Enregistrer un commentaire