Need help with physics in Game Maker Studio

Talk about your skill passion! Ask questions, get feedback, post something cool!

Moderator: samw3

User avatar
Isaiah222
Posts: 94
Joined: Sat Jul 30, 2016 8:29 am
Location: Sweden
Contact:

Need help with physics in Game Maker Studio

Postby Isaiah222 » Fri Jun 30, 2017 5:51 am

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?

Return to “Programming, Art, Design, Sound & Music!”

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron