Tutorial 19: Enemy drops


Enemies can drop default items (mainly potions) when they get killed by the player. Use the field allowDrop to decide if the enemy will drop an item or not. But most important, you can also assign a specific item to the enemy (a key, a potion, a book, a scroll…) and tell the game to drop this item when the enemy dies. Let’s do that!

Start by creating a skeleton. Select Helpers/NpcSkeleton and right click to add it to the map. Left click on it an see how the allowDrop field is set to True by default.

 

Now let’s add a key. Select Helpers/ItemKey and right click near the skeleton to add the key to the level.

 

Now we need to link both elements. Left clik on the skeleton and release the mouse button. Now press and hold C, and then left click on the key. See how a green line appears connection the enemy to the key. If you left click on the skeleton you will also see how the reward field has been set to the name of the item.

 

That’s all you have to do! Just save the changes and play the map. Try to kill the skeleton and see if it drops the key or not! đŸ™‚