Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.