Skeleton Enemy — Dungeon Escape

Going over my implementation of my Skeleton Enemy in Unity

Objective: Walkthrough my implementation of my Skeleton enemy for my mobile game, Dungeon Escape.

Code Optimization

Before starting on my Skeleton enemy, the first thing I did was optimize my Enemy C# script. The reason I did this is that the movement behavior for my enemies is pretty similar, so it only made sense to further optimize my script to handle this. With the changes I made, I was able to move all code for both my Spider and Moss Giant enemies into the parent class. The Skeleton enemy will also be able to make use of this. The code I refactored is shown below.

Doing this allowed me to have empty scripts for my Moss Giant and Spider enemies as they inherit all of this code from the Enemy parent class.

Example of empty class that still works in-game due to inheritance

As can be seen, the Moss Giant enemy still properly performs their actions (the same goes for the Spider enemy as well).


With these changes now in place, we can go ahead and start creating the animations for our Skeleton enemy. Just like I had done for my Spider and Moss Giant enemy, I will be creating the idle and walking animations for now. Once implemented, the below gifs demonstrate how our Skeleton enemy looks.

Idle Animation
Walk Animation

Lastly, I hooked up my animations in the Animator Tree to prepare the animations to be controlled with code.


Now since we had optimized our code earlier, we can leave the Skeleton enemy class empty, and it will still work so long as we are properly inheriting from the Enemy parent class.

The result of this setup is shown below:

That is all for today’s article! Thank you for taking the time to read. In the next article, I will begin creating the attack system for the game.




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Revisiting Remote Desktop Lateral Movement

How to Deal with Duplicate Record(ODI)

BloC Pattern For Login: bloc_login in Flutter

Calling a REST API with Oracle Data Integration and Functions

Adobe AEM integration with Magento on Mac (without MAMP) Part-3

Symmetrical Components

Symmetrical components

Facing Your Fears Virtually: COMPLETE

#freestockphoto (Saturday 21st 08AM)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Gabe Gomez

Gabe Gomez

More from Medium

Platformer: Collectible & Status Bar

Adding a new ability to our prototype — The Triple Shot

Installing Probuilder In Unity

Light layers in Unity HDRP