Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I recently watched this tutorial "Actor Constraints in GameSalad" detailing how to constrain the center of an actor to the mouse X and Y, but I would like to constrain the relative clicked pixel of the actor to the mouse X and Y, not the center of the actor.

In other words, I want to avoid the "jumping" nature of "constrain self.Position.X to game.Mouse.Position.X" when I click and drag.

share|improve this question
Hi nipponese, and welcome to GDSE. Since your post is already tagged with 'gamesalad', and this will almost always appear alongside your question, you don't also need to dump the tag in your question title. I've edited it out. – doppelgreener Nov 15 '12 at 1:10

That's simple. When the actor is clicked, store the difference between each coordinate and the (0,0) spot (wherever that might be) in a couple of variables. Then as the mouse is moved and you move the actor, subtract those stored values from the mouse position to determine where the actor should be placed.

Note, I have no knowledge of Gamesalad in particular. It does have variables right?

share|improve this answer
Note that when you have no knowledge of the technology the question is about, your answer is unlikely to be helpful. – Philipp Feb 13 '13 at 15:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.