• 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!

Move Objects With Your Mouse

M

MUZZY

Guest
In my game, you basically pick up objects with your mouse and throw them away. I tried to create a rope joint between the object and the mouse pointer, but it only allows me to move it around, and when i delete the joint, the acceleration that it used to have doesn't affect it.

Is there any way you can find out the acceleration of the object, and than apply it to it again? I will be very grateful...
 

jazzzar

Member
show us some code to be able to help you,anyway, i will try to help with no code at all, save the acceleration of the object before destroying the rope and after destroying it add that acceleration to the object
 
G

GewoonNiels

Guest
Use the xprevious and yprevious variables.
The direction of the moving object would be: point_direction(xprevious,yprevious,x,y)
And the speed would be: point_distance(xprevious,yprevious,x,y)

Use the above code at the moment when you release the object, and apply all physics afterwards
 
Top