Did a bit more inventory programming to resolve some of the bugs and minor issues.
First thing was that I had to figure out how to create a lot of random items with different stats without creating a weapons class, potion class, and so on. What I did was to just create a basic item class that had all the information that all items must have. I the added a HashMap where I add all the stats that this item will affect and by how much. I then just run through that map and add or subtract from the player stats when an item is used.
I added item description, so when you move the mouse over an item, it shows name and the stats it will modify. This might have to be changed in the future if items start having a lot of stats as they just get rendered next to the mouse cursor.
Also prevented ground items from exceeding the 8 boxes. Still have to add a way to scroll through them or some other way. Could be to just push the remaining items to a tile next to this one. It's the Diablo 2 way. You could not have more than one item on a tile.
Anyhow, I only need to equip items and the inventory is done.
No comments:
Post a Comment