Devlog 3
There is a lot to go on in this devlog as I might have skipped making them daily, but let’s get to some interesting code parts!
Enemies and Combat
Last time we added enemies and solved the drawing issue, so let’s get to the meat of the game, combat. For the moment it’s a crude system (I may want to implement a dice based system, we will see), but it’s a good proof of concept!
First of all we need health points and something to deal damage with. For this I added 5 stats to each entity namely: Health, Armor, Strength, Dexterity and Intelligence. Health is pretty straight forward, armor will reduce incoming damage with a flat value and the 3 attribute stats will deal different damages and with different rules. We can deal with that later, let’s handle just hand to hand strength combat.
For this we need an in-combat window to showcase our character ’s stats and possible skill usages and the current enemies in the characters tile. The window system we had setup earlier and to trigger it in combat, we check if the current player is standing on a tile with an enemy on it. If yes, we trigger combat mode, and stay in it as long as there is an enemy alive. This process is not the most attractive as I found out the code is not properly structured to handle these kinds of operations during runtime without some ugly checks and for
-s. Algorithm rundown here
In a quick rundown, we grab the enemies by index, who are standing on the same tile as the player. If we find any, we enter combat mode, in which the player has to choose a skill to use and an enemy on which to use it. Currently combat consumes all actions as I want it to be once per turn, but we will see the gameplay effects of that later.
New enemies appearing
After this hacky combat is handled we need to actually add enemies to newly found tiles. For this we need new enemies so let’s refine our cultist and add a demon and a tentacle to the roster!
We use two images for each, one to showcase them on the map fully, and a smaller one in the combat window! Also we need some icons to showcase all of this!
Tiles and new UI
Yesterday I started revamping the old UI so now we have a mostly new one! Give a warming welcome to the sacrifice counter on the right, as it fills the game will be closer and closer to ending. Upon reaching the top, the eldritch horror is strong enough to break the seal and we lose the game! Time is ticking, let’s find the key to the boss room!
Also I was not happy that the tiles just appeared from nothing and redid an old failure code, now we draw cards from the deck and place them for the new tiles on the screen!
The effect itself is not that complicated, upon adding new tiles we create the cards, which travel to the location. After they reached it they set the new tiles in the dungeon collection so we can progress further apart!