Pressing buttons!

bringing the "current bounty" system up to speed!


9/11/20232 min read

I'm fairly proud of the solution I drummed up to improve the "current bounties" page in the Atlas. This batch of code had many (if not more) of the same problems that the inventory management system had. So if you haven't read that post yet, you can click this link to do that now! 😁

  • We start by checking that the dictionary (active bounties) contains at least 1 "Key" (bounty).

  • currentKey is initialized and set to 0.

    • This integer will be used as a way for us to choose the 1st bounty in the dictionary for bountyButton1, the 2nd bounty in the dictionary for bountyButton2, and so on.

  • bountyButton1 (a button game object) is set active and we enter a loop that goes through each bounty in the dictionary of active bounties.

    • each time we loop through the dictionary, the "currentKey" integer increases by 1 and the loop will enter its next phase once it hits 1 (the first bounty in the dictionary).

      • for bountyButton2 currentKey would stop at the second bounty, and so on.

  • The button text is updated to reflect the name of the bounty and an integer attached to the button (via the "IdentifierHolder" script) is updated to reflect the unique bounty identification number!

    • each bounty in the game has an identification number so the many features that interact with the bounties can quickly call the name, description, etc.

  • last but not least, we add a listener to bounty1Button!

    • the listener "listens" for when we "click" the button. When this happens it activates a method (not shown) that sets the description box text to the unique bounty description.

See it in action below! 😁

This system will more easily allow me to add more bounty buttons. My goal is to initially only allow 2 or 3 bounties to be active at a time to keep players focused. As you progress you will have the option to purchase more RAM for your Atlas and therefore hold more bounty buttons!

What we did here today will make future development MUCH easier!

If you are a fan of scifi, 16-bit, metroidvania's, or you simply like trying/supporting indie games, make sure to add Age of Irata to your steam wishlist! It is the biggest compliment when I see that wishlist number grow.

Link to the Age of Irata Steam Web Page! 😁