Weekly Devlog 2 - Level (enemies)


This week instead of focusing on levels, I focused on editing my map and working on enemies. 

For the map I made a tilemap collider 2D, but turned the black tile's collider to none, so only the walls are colliders.  I had to crop the size of each tile sprite so that the collider was more closely aligned with the actual wall image, the corners are still a little awkward as they are not rounded.


All enemies have 4-way movement animations. The bat has a seek behaviour attached and has 1 health. Friendly Ghost has wandering behaviour and if you run into it or hit it with a fireball it turns into a malicious ghost which has a pursuit behaviour and 4 health. Grim is meant to be pathfinding though I haven't been able to get that to work yet. I tried using the node generator from the tutorials, but for some reason it wasn't detecting my colliders, which meant nodes generated everywhere, even on my walls. I edited the script so that it  only place nodes on black tiles by checking what the tile name is at each intended node location, which solved node being generated outside of walls as well. Despite that success, the grim does not follow/interact with the nodes, and instead tries to seek Lich, which means it gets stuck on walls. I have yet to fix this. 


 I had to edit all the behaviour scripts so that the animations would work, as the Mover script moves them via position rather than using rigidbody velocity. I found it quite challenging to get the referencing of game objects correct in the behaviour scripts as the scripts are attached to a prefab and i was trying to assign an object in scene, which meant I kept getting type mismatch errors. To fix this, instead of referencing through a public variable and dragging the desired object in unity, I used gameObject.Find ("gameobject")in the script, which allows the in scene gameObject to be assigned once the prefab is instantiated, eliminating the type mismatch. 

All enemies and Lich flash red when getting hurt, by changing the sprites colour to red for a short amount of time, then returning it to white.

I implemented a spawner this week, it uses set locations to randomly spawn an enemy in, with the condition the spawn location is not within view of the camera. It spawns as long as there are no more than 15 of each enemy type alive. I used for loops to check which enemy was trying to spawn and see how many of that enemy were already in scene. It took a little to get it to work, and I was able to work out which parts weren't working by using Debug.Log to see what happening. The only issue with the spawner is that  I have to be careful editing the map, as some of the spawning locations may be outside the walls. If I have time to polish my game at the end, I may adjust the spawner so that enemies can spawn anywhere that I out of sight, but still within the walls. I also need to make it so my enemies don't push Lich, and fireballs don't push enemies. 

I've started working on soul collection and usage: Enemies drop certain amount of souls on their death,  there are scattered souls around the map which can be picked up, and firing  a fireball uses a souls.  I made a UI text that displays the soul count. Again, I had some referencing difficulties, but it was much easier to fix up after learning the issues with the behaviour scripts. 


Feedback from tutorial: Field of view is a little small, and fireball may be a little too big.

I've adjusted the camera so its closer to a square in shape, so you have roughly equal warning of incoming enemies from all directions. I have slightly decreased fireball size as well. 

Files

Lich In Limbo Tut 2.zip 8 MB
Apr 26, 2023

Get Lich in Limbo

Leave a comment

Log in with itch.io to leave a comment.