Days: 28/01 and 29/01

Bugs fixed

In the last devlog we had an issue with the collision that I couldn’t solve. But fortunately we found the answer in Unity API!. The answer was in the rigid body added to Treant.

Colliders on a GameObject that has a Rigidbody are known as dynamic colliders. Static colliders can interact with dynamic colliders but since they don’t have a Rigidbody, they do not move in response to collisions

Particle System

After the bug was fixed we add a particle system to make a blood effect for when the monster or player got a hit it shows up. In the beginning, it won’t show in the treant. We had to make a Prefab from the particle system, edit the properties to make small and finally add to the Enemy script.

When we called from the script, it won’t show the particles. To fix that bug we use this answer Particle System object (tab Renderer) value of “Sorting Fudge” to -100.

Now we have this:

Player hitting the tree

The code to execute this is simple:

var bloodClone = Instantiate(bloodEffect,
                             gameObject.transform.position,
                             gameObject.transform.rotation);

Destroy(bloodClone, bloodClone.GetComponent<ParticleSystem>().main.duration);

Added to Enemy.cs, TakeDamage method. Now every time the object gets hit, it will instantiate a particle system that will be destroyed when it`s over

For the next days, we want to

  1. Change the scene layout for one that has snow ground and with trees
  2. Add the bonfire
  3. Add idle animations from is a side character
  4. Fix the bug that character can damage enemy hitting from down or up if the enemy is near