A large issue I had noticed with the Wrought enemies, was that in order to aim towards the player, the entire gameobject would rotate in the direction of the player. Therefore, its sprite would also rotate towards the player; which needed to be fixed immediately.

The process I chose to fix this issue, was to use a child object which would rotate independently of the parent object that would have the Sprite Renderer and Animator components. This child object would act as the sprite renderer and would rotate in the opposite direction of the parent object, effectively counteracting the rotation and causing the Wrought’s sprite to appear as if it weren’t rotating at all.

Furthermore there would also be a second child object that would act as a hitbox:
To allow the child object to deal damage to the player, I wrote a simple script that would check if any collisions were from the player.
If the player was the other object in the collision, it would call the TakeDamage() method in the player’s PlayerHealth script and cause the player to take one HP of damage.

Bug fixing

When creating a separate child object for the sprite renderer, it cause a lot of unintended issues with the physics of the game. As the parent object would act as the hitbox, its has a RigidBody2D component to allow it to collide with walls and stalagmite obstacles in the dungeons. However, the child object containing the sprite renderer didn’t have one. This would cause the parent object and the child object to misalign whenever a collision would take place.
To fix this, I gave the child object a RigidBody2D component and altered its mass for collisions.

The invisible Wroughts issue, however, was a much easier fix. Simply going into the Wrought prefab’s sprite renderer component and changing its Order in Layer to be higher than the Dungeon’s floors made it visibly in the Dungeon.

This bug was caused by values that weren’t being set, specifically the Velocity X and Velocity Y values, as these values were being used by the animator in Unity to decide what walking and attacking animation to play for the Wrought.
