Drag objects that don't snap to mouse position

5
Your rating: None Average: 5 (1 vote)
Difficulty Level: 
Intermediate
Topic: 
Game Coding

A simple piece of game-code that makes a game feel a little more professional.

You'll often see games where you can move an object by dragging it with the mouse but when you do the object snaps to Xmouse and Ymouse. It doesn't take much extra effort to have it clip to the mouse at whatever point you clicked .

It's just a matter of saving the difference between the X,Y coordinates of the mouse and the X,Y coordinates of the object.

The download includes this tutorial as well as a few others.

~DOWNLOAD~
http://www.filefront.com/14525049/RTS_Tutorials.zip