LOG 25: FLEEING ENEMIES (CONTAINS MANY CHANGES), BOSS ITEM REFACTOR
FLEEING ENEMIES
Enemies (except the boss) now have the ability to run away if the enemy would get killed by the next attack. The chance for this to happen is 10% and when they run away, they gain 1 HP per step they take and return to chasing the enemy if their hp is back at half of their max HP.
FLEEING REWORK
Before adding this feature, fleeing was the same practically as winning (the return type of the fight was STATE_VICTORY), i changed that to the proper STATE _FLED. Also before when fleeing, if you fled and another enemy of another type collided with you, he had normal stats but the enemy before that also got his stats reset. The same went for enemies of the same type. When fleeing from enemy A from type A and then colliding with enemy B from type A, he would have the stats of enemy A. The fix for both was to make a 2D Array of all enemies and their types, so each individual enemy stores its stats, not the battle function.
PLAYER POSITION STRUCT
Previously the player had ~ 8 different position variables, which was pretty clunky if i wanted to transport the player position to another function. Because of that i put all player positions into a singular struct, so i could pass all the player positions at once if i needed to.
ENEMY PURSUIT FUNCTION REWORK
Because enemies have to run away instead of chasing i had to rework the pursuit function a bit so it could also work in a reverse way. I had to make the function branch between the two states which took a bit more work than originally anticipated because i had a bunch of wrong ideas for how the function should work. Overall the function implementation was essentially to just use the inverse vector of the normal vector for the direction function
BOSS ITEM FUNCTION/ITEM FUNCTION REFACTOR
Because previously the boss item detection function and the item detection were separate the code didnt feel clean at all (felt like a lazy implementation for me), so i made the item function work with the boss item which makes the item function overall more open for new item types (if i will add any more)
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.