This last week I couldn’t invest much time in Panda Hell (~7h total) however I could move forward a bit in the A* pathfinding implementation , so enemies act smarter. At the moment the script analyzes the terrain that has been generated and sets a layer mask on top which differentiates the terrain in either walkable or non-walkable.
You can see here the layer mask and how it differentiates between walkable terrain (grey) and non-walkable terrain (red).
While the current layer mask works and calculations are done accordingly, when added to enemies it makes Unity crash easily, either the level has too many objects for this to run smoothly or there’s something I missed, so I’m still working on it in order to optimize so it can do the calculations for multiple enemies at the same time without breaking the game.
But something else took most of my time (and soul) this week and past week: The bug.
For some reason a few days ago I discovered that my shoot-to-mouse-position system was not working correctly. When the player is in the center of the screen it does work, but when you move around it does not, which I initially though was likely related to the 2D coordinates system and how you have to translate everything from 3D to 2D as well as take into account mouse position.
After some debugging ( actually rewriting it multiple times in multiple ways, took basically 6 to 7h) I discovered that the actual coordinates system and camera were working well (sigh…), and this only does not work on first execution but if I edit and re-save any script during run time, the system works perfectly fine. And by editing any script I mean just adding a space to any script of the game while the game is running, save the changes, it re-compiles after a few seconds and suddenly works smooth as silk…
After much thinking, experimenting and a reddit post later I was given the idea that maybe the methods in charge or referencing the coordinates system or the shoot-to-mouse-position system were pointing somewhere that was not fully loaded in Start() or Awake(), meaning that on re-compiling the game, everything was loaded and just working as expected.
This resulted to be indeed the issue, however playing with Start() / Awake() for both objects didn’t throw the expected results and I ended moving the whole class into the Player, which is not optimal but fixed the problem.
While until now I’ve been doing weekly updates, I’ll be pacing them differently from now on and update when I’ve accomplished new meaningful milestones, as some weeks like this one there’s not really much to report besides “I fixed a bug that was not there last week” 🙂
I still think I can make an itch.io demo deploy before the end of the month, unless I encounter anything else that slows me down (like this week).
- Added sounds to item pickups (coins, hearts, ammo, etc, …)
- Added UI starting menu, pause menu and game over menu as well as restart functionality on game over
- Adjusted the game procedural levels: levels felt too big, these are half size now
- Fixed the Spawner class, now enemies only appear on valid floor tiles, randomly
- Added a grenade launcher area damage explosion effect and bouncy bullets (so you have to be careful to miss!)