Project RBH Devlog 0081 (Patreon)
Content
It’s very rare for the pseudocode I write in my head to actually work as I expect it to the moment I implement it, and yet I lucked out when it comes to changing the AI to target the decoy instead of the player.
I think I covered this last week, but the basic idea is that the first thing the enemy AI does is check if a decoy exists in the world. If so, the closest decoy to that enemy becomes their target whom they will pursue and attack. If no decoy exists, they will instead pursue and attack the player character. This will always prioritize the decoy(s) over the player.
Drawing aggro in a game where there are generally few enemies on screen—especially if they always go for the decoy—could have some negative effects on game balance. However, I feel that enough enemies attack without aiming, or have attacks that for example explode, that even if they aren’t directly targeting the player they can still present a threat. And since projectiles in this game are actual objects instead of hitscan checks, it’s still possible to get hit by an enemy aiming at the decoy.
The decoy uses the same sprite as the player, but I used the draw code to change the color and opacity, while the decoy itself has a timer that causes it to randomly change which direction it faces. There is no gameplay reason for this, I just think it looks better if the decoy is doing something.
Now all that’s left is to set up the dodge system so that it can spawn in objects when you dodge, which again should not be hard at all.
Until next Devlog!
-DeusVerve
DevLogs like these are brought to you by Patron(s) like Haelerin!