• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Strange behaviour with motion planning (mp_potential_step)

B

Beggar Studios

Guest
I am making an rpg in GameMaker Studio 2 and I have a problem with mp_potential_step. I am using it to have the player automatically dodge out of the way of falling debris, but I have weird behaviour when dodging to the left. When going to the right the player just goes in a straight line to the right, however when the player dodges left he goes up, left, down and then left again, as if the player is avoiding some invisible object to the left of the player. This is the simple code

Code:
mp_potential_step(x-30, player_y, spd, false);
I have the check_all parameter set to false so it only checks for solid objects to avoid, but I use custom collision checking so I don't have any solid objects in the room! What could be causing this behaviour?
 
If I'm not mistaken, mp_potential_step has a default value for how much per step it is allowed to "turn". You can change this by using the function 'mp_potential_step_settings'. Information can be found in the manual.
 
  • Like
Reactions: Yal

Yal

šŸ§ *penguin noises*
GMC Elder
It's also worth keeping in mind that mp_potential_settings changes all mp_potential_step's parameters until the next time you call it; I change the settings right before calling mp_potential_step everywhere to make sure they're correctly set for every object that uses the function. (It's just changing some variables anyway so it's not really an expensive function to call, so I'd say it's a good habit to have if you use mp_potential_step a lot)
 
Top