Page 1 of 1

Need help with physics in Game Maker Studio

Posted: Fri Jun 30, 2017 5:51 am
by Isaiah222
I want to be able to give an instance more speed when I click the mouse closer to it. So far the best code I have made is:

Code: Select all

physics_apply_impulse(mouse_x, mouse_y, (((phy_position_x - mouse_x) / 2) * 10), (((phy_position_y - mouse_y) / 2) * 10));
But If you try this you will notice that the instance will get more speed the farther away you press the mouse from the instance. I want to reverse this; that the instance will get more speed the closer I get to it. Anyone got an idea?