In my last DevLog, I wrote about giving enemies the ability to destroy power-ups. I realized that the result might have been too powerful. With that in mind, I will try to balance out the equation with an additional tool that the player can use.
Add a magnetic mechanic to attract power-ups.
How I went about it:
The idea is simple. The player can press a key, and any powerups within range should gravitate to their position. My first step was to create a Script to implement the attraction behavior.
With this simple Script, I control the power-up’s attraction state with a bool. I then move the power-up towards the Player so long as the condition remains true.
The next step was to create a method in the Player Script to activate the attraction bool.
By pressing the ‘C’ Key, this code will look for all instances of the AttracBehavior Script. Once it has found them, it will change the value of each bool to true, provided the object is within range. By releasing the ‘C’ Key, the value of each bool will change back to false.
After adding a few more bells and whistles, the result works as expected.
This new mechanic should mitigate the enemies’ ability to shoot down power-ups. I feel that this balances both items and creates more dynamic gameplay.
Mark this one as done!