Left and Right

So I changed the bot’s movement code.

Previously I use this to move the bot around:

physics_apply_force(xpos, ypos, xforce, yforce);

My initial thinking (and my lack of experience using physics engine) was I need to use force to move physics object.

This made the bot harder to control. It skidded too far when stopping/changing direction. I want this game to have precise and responsive movement, because currently I am aiming for not-too-fast-paced-action-with-some-strategic-thinking type of gameplay.

While searching some physics parameter I could use to fix the issue I realized GameMaker’s physics have these variables:

phy_speed_x; phy_speed_y;
phy_position_x; phy_position_y;

Why would I adjust the force and parameters while I can just shift the position/speed? So I returned to my usual way of making movements in a game, while still using physics engine for its gravity and collision features. The movement became snappy enough for my taste.

Oh and I found a nice tutorial on GameMaker’s position and motion functions. I used GM’s lerp function to accelerate and decelerate the bot like this:

phy_speed_x = lerp(phy_speed_x, CONST_MOVE_SPEED_X, CONST_MOVE_ACCEL_X);

Meanwhile, climbing is not fully implemented yet.

Leave a comment