Creating the kit for creating

Reading Time: 2 minutes

Last week we’ve created the very basis of the entity-tree to enhance the workflow of adding the various beings into the world. Our next goal is to add a little bit even more important part of the mechanics: interacting with items. Especially: picking up stuff from the ground.

For this we’ve created some new items:

A dagger, a hammer and a chest.

The first thing I planned to achieve is to be able to click on a pickup item so the player can move to its location, and pick up the item itself. As a start, after the pickup happens the item gets destroyed. Step one is to identify somehow if the clicked entity is a pickup item we’ll check if it’s close or far away. If needed, the character will be instructed to move closer. Once the character is close enough, the pickup mechanism should be triggered. Since we want to preserve the option that NPC’s can also interact with objects, this functionality will be done in the main ancestor, LivingEntity which we created last week.

To keep things simple for now I’ve applied the Pickup logic for the hammer and the dagger, but for the chest, I kept a loose end as it will be serving its purpose when we’re creating a kind of inventory or storage. Still for the chest, the logic of getting closer before interacting is still being applied. Future me will express his thankfulness for it. 🙂

After this was done I was starting to think on having the items being highlighted. The first rough idea is to create a new shader for having the highlight effect on each of the items, and when the player moves the cursor above the object the code will switch between the original and the highlight. After implementing I’ve realised, there are other ways which might be more interesting and flexible. I’ll come back to this topic later I think, for now it’s good enough to have the interaction flow going.

So far these steps resulted in the extremely short video below:

After these steps I started to implement some Debug Tools for ourselves, but that’s for a later post 🙂

Leave a Reply

Your email address will not be published.