03-19-2025 01:33 PM
I have a medkit that gives a player health when he grabs it. What’s supposed to happen is
1. player grabs medkit :white_heavy_check_mark:
2. medkit provides health :white_heavy_check_mark:
3. medkit is force released :white_heavy_check_mark:
4. medkit moves to new random position after release by player :cross_mark:
What is wrong with my code?
03-19-2025 07:42 PM
World start populates the list and calls move.
Move will try to move through all the position locations within a single frame and you won't see it. But it also removes the positions from the list. When grab happens, the list is empty. It won't move and even if it didn't remove the positions from the list, it'd randomly move through all the positions for no reason.
What you want to do is keep the positions in the list. just pick a position at random and move it there. If you don't want the same location, just save the current index as a variable, and while the random locations != last location, pick a new random location.