Hello guys,
i am making a small shmup with the ship having a magnet for pulling credits that stay behind destroyed enemies.
The first part was quite easy:
1. I put the Get Distance action and i store the distance from the object that will be attracted to the Player in the Distance variable.
2. In the Conditional Expression, if the Distance variable is under predetermined value, we go to the next state.
3. Move Towards action is targeted towards Player, with the Max Speed set as MaxSpeed variable.
4. In the Fload Add action i set the Float Variable to MaxSpeed, set the desired increment in the Add field, check every frame, and the magnet is working.
5. To stop the magnet from working, i insert Get Distance action and Conditional Expression again to revert to state one when the object gets out of the magnet's "range". Unfortunately, it stops immediately. So i inserted the third state with Ease Float that will revert to the first state on finish event, but i'm not sure how to set it up, i'm using MaxSpeed as From Value, To Value is 0, but it stops immediately also. I also tried to use Get Speed 2D action, store it in Speed variable and put it in From Value, but it's not working. Any ideas?