Easy way to implement dropped items in rogue-like game?

754 Views Asked by At

Basically I have a rogue game I'm making, and am trying to implement dropped items for when the enemy dies. I've tried a couple different methods on how to do this, and none have been successful.

I was just wondering if you have any ideas on how you would go around such a thing. Thanks!

1

There are 1 best solutions below

0
On

I haven't gotten to items in my current wip Roguelike engine, but here is an outline of my current plans:

Both map tiles and entities act as containers for entities. When an entity in a tile suffers an item-dropping event (i.e. normal death) you could just append the contents of its inventory list onto the tile's contents list.

I also plan to add logic for tile/entity capacity though, so you can't carry walls off (usually?), and tiles can't contain infinitely large piles.. Also since you probably want to control item drop frequency and type it is probably best to give entities a method that returns a list of inventory they dropped.

+1 to https://gamedev.stackexchange.com/ though, I didn't know that existed.