Thursday, October 10, 2019

Release 0.2 Second Issue

For my second issue as part of Release 0.2 I am working on a project called Ancient Beast. It is a game which you can try out here:

My assigned issue can be found here:

The game is kind of like a table top game where you the summoner can move across the map. As the name implies, the player can summon monsters to battle opponent summoner and their respective summons. By clicking on the third icon, users can view within a modal; a list of creatures that can be summoned with their current resources, once a creature has been chosen a layout of where they can place the creature is then shown.

Currently, every time a user clicks/opens the creature list, their default creature is always randomized to an available monster they're able to summon. This is a hassle or slows down the flow of the game when a user previously viewed a creature they want to summon, but they want to re-position their summoner to summon a creature they previously had viewed.

The change asked by the maintainer is to have the game remember the last previously viewed creature. So when the modal is opened, it will default to the last previously viewed creature instead of a random one.

I was trying to understand my way around the program more so I had a bunch of console.log()  messages to see which functions were interacting with each other... for some reason I wasn't getting anything. It wasn't until I realized I had to disable cache in the f12 - network tab and clear browsing data every time I wanted to test changes to the code. Learned my lesson after 2 hours.

After a few days and a tip from the professor I was able to get the enhancement working

I added a few things:
  • clicking on a creature while in the creature menu will assign the creature id to lastViewedCreature
  • a check to see if the object's lastViewedCreature variable was empty. If so it will pass a variable to the function responsible for displaying the creature window to randomize it, otherwise it will open the creature window with the last viewed creature already selected
  • passing current player's turn will set the lastViewedCreature variable back to empty so next player's creature window won't default to the lastViewedCreature of the previous player

No comments:

Post a Comment

Attempt at Creating a Clone of Adventure Capitalist

After about 3 weeks working on this project, I'm kind of done. Built with React/Node/Redis/SocketIO I learned a lot. The reason I say I&...