Devlog 5: Items Pickups


This week, I was working on adding item pickups into the game. The first part of adding item pickups to the game was to create a base item pickup class, so I can use inheritance to make the item pickups easy to add to the game. This will allow me to reuse the code for the other items without rewriting the same code and it will build a strong relationship between related classes. The base item pickup class has the code that is used to allow the item to be picked up and add it to the player's inventory.

After the base item was added to the game I moved on to adding some of the important items like health, food and weapons. The health item was easy to add to the game because when the player uses the health items, the game will add the specified amount of health points to the player. The food item works in the same way by adding the specified amount of hunger points to the player when the player uses the hunger item. The last item I added, for now, was the player's starting weapon. The player will start with a pistol that can be used for self-defence. I will be adding more items into the game as the game progresses.