Easing toward mouse position
ADSentertainment
Member Posts: 397
I'm trying to make an actor quickly accelerate towards the mouse position, but I don't want it to accelerate past it and take 200 million years and 3 months for it to finally stop moving all over the place and stay in place. I want it to slowly ease to the mouse position and come to a nice stop and maybe wobble a bit before finally stopping (to add a dynamic feel). Does anyone know of a way to do this easily? I also don't want to have to use an interpolation behavior if possible, since I don't want it to ALWAYS take a certain amount of time for it to reach the mouse position, as it could either move too fast or too slow. Thank you!
Having trouble with your game? Sounds like a personal problem.
Comments
Constrain self rotation to vectorToAngle (mouse x - self x, mouse y - self y)
Move / 0° / Actor / Speed magnitude (mouse x - self x, mouse y - self y)
Hold on, I'll make a demo . . .
Here you go . . .
https://www.mediafire.com/?dra8ia5rc15h0ch
@Socks -- Very smart!
Are you using one of the dev builds of Gamesalad by chance? It says that my Gamesalad can only use version 2.0 files and that yours is version 2.1.
Having trouble with your game? Sounds like a personal problem.
Yeah it's nice and simple too, and of course you can multiply, add to or divide the speed part to make the overall action faster or slower.
I'm not sure what a 'dev build' is, this was done with 12.4.
another way is:
constrain self.motion.linear velocity.X to 3*(game.mouse position.X-self.position.X)
constrain self.motion.linear velocity.Y to 3*(game.mouse position.Y-self.position.Y)
3 is speed and can be changed.
✮ FREE templates at GSinvention ✮
✮ Available for hire! support@gsinvention.com ✮
Like, are you using a pro exclusive version of Gamesalad? Because mine is completely up-to-date, and your file can't open on mine because it basically says it's being used by a newer version of Gamesalad
Having trouble with your game? Sounds like a personal problem.
What is a 'pro exclusive version of Gamesalad' ? I wasn't aware there were 'pro exclusive' versions (or even 'dev builds') ? Did you try the method, did it do what you needed ?
Like a nightly build. I know that they do (or used to do) those, but they were for pro members only. Here, lemme show you what message I'm getting whenever I open it:
Having trouble with your game? Sounds like a personal problem.
Ok ? So I did it with an exclusive-Pro-dev-nightly-build (which GS no longer make) that only I, as a non-Pro user, have access to, sounds like a reasonable theory to me I can sell you a copy of this secret version if you like ?
Did you try the method I posted ?
@ADSentertainment -- maybe this thread will show how to get @Socks' example to open:
http://forums.gamesalad.com/discussion/72787/gs-tips-open-gs-project-in-older-version-of-creator
Wait wait wait, whaaa. Weren't you previously a pro member though? I could have sworn you were before!
Having trouble with your game? Sounds like a personal problem.
@RThurman, I actually used @timolarpe1998's example, although I might eventually take a look at Socks'. @Socks, did your example actually make the actor rotate while moving? I inputted what you put on the forums to see for myself, and it showed it doing some rotations, which was kinda obvious due to you using the rotation attribute.
Having trouble with your game? Sounds like a personal problem.
Ok, so you tried the method I posted, you saw the actor rotating, which you concluded was obvious given it effects the rotation attribute, so your question is does my example make the actor rotate (this is the actor you saw rotating) ? And you've yet to try my example (the example that you've just said you've tried) but you might eventually get around to taking a look at it, lol
I'm not sure how to answer all that, but yes the actor does rotate, although I'm not 100% sure as I've not seen or read this thread yet
I think I need more coffee
Yes, I was a Pro member before, and one day I plan to be again, but right now I am not.
You need to be on the latest Release Candidate, that is 0.12.6, or at least on 0.12.4
Those can be downloaded even by non-PRO members.
@pHghost
Do I have to redownload it? Because I tried looking for updates on Gamesalad, and it said I was up to date
@Socks By rotate, I mean does it rotate in such a manner similar to a plane when moving? I just wanted to be clear
Having trouble with your game? Sounds like a personal problem.
@ADSentertainment -- that might be caused by the Stable being switched to an RC...what version does it tell you it is? That's the easiest way to find out. The error you are getting makes it look like you have an older version.
Go to: GameSaladRC > About GameSalad and it will tell you the version in the corner.
ks By rotate, I mean does it rotate in such a manner similar to a plane when moving? I just wanted to be clear
Did you try it, it's two behaviours, just try it out and see if it's what you need.