Showing posts with label drop. Show all posts
Showing posts with label drop. Show all posts

Weaponry

Previously I had implemented armor. You could find it in the dungeon and pick it up. Armor showed up in your inventory. You could drop the armor you picked up. Today I implemented weapons.

It turns out that weapons are similar to armor. They have a name. You can pick them up. They show up in your inventory. You can drop them if they are in your inventory. They have a symbol for display purposes.

In programming terms, I found that armor and weapons share properties and functionality. I was able to determine that these are two specific cases of the general idea of items. Once I got the item behavior down, making some weapons that are items was easy.

I hope this mean that other item types such as potions, rings, and amulets are also easy to add. I think I am getting the hang of this.

Inventory Control

I implemented an inventory dialog for my roguelike game engine today. It shows all the items you hold. It also identifies each item by a unique letter. This made it easy to implement a drop dialog as well.

There are some things to think about for my drop dialog. For example, the user must press the letter to identify the item to drop. Fair enough. But I also make the user press the Enter key to complete the choice. I really should make the choice automatic upon the user pressing the letter key.

I have also glossed over the issue of the user dropping an item on top of another item. Right now it will stack the items on top of each other. But I have not implemented what happens when you move over a space that has items stacked on top of each other. Those are small details though.

Currently I only have armor in the dungeon. So the inventory and drop features only work with armor. If I can generalize this to include other items such as weapons, potions, scrolls, and rings, then I should be good.