How can I change speed of actor without changing direction?
Dell7730
Member, PRO Posts: 388
My ball actor is launched with Accelerate Toward behavior at -3500 acceleration, how can I slow it down without making any change to direction? just let it fly off but with decreasing speed.
Best Answer
-
Socks London, UK.Posts: 12,822
@Dell7730 said:
i have it -3500 to start fast and i want it to slow down gradually by any speed.. i'll give your suggestion a try and let you know what happensIf you want the actor to start fast then Accelerate is probably the wrong choice as Accelerate, by definition, starts slowly and increases in speed.
As for slowing an actor down there are lots of ways to do this, if you were using a Move behaviour you could interpolate the speed down, or if you want to stick with Accelerate then you could simply increase the drag over time.
Answers
If you want to slow it down, can't you just make the Accelerate Toward behavior at -1000 instead of -3500. The only other way i can think of is changing both self.motion.linearVelocity.x and self.motion.linearVelocity.y by the same factor.
like if actor is clicked on or something divide both velocities by a same factor/number
i have it -3500 to start fast and i want it to slow down gradually by any speed.. i'll give your suggestion a try and let you know what happens
hmmmm, still can't believe i'm seeing a lot of letters, not just letters but words, not just words but sentences and not just dots like ..... hahaha
But joking aside, i'll give your suggestion a try, you know I will lol
I tried the move behavior, both of them, problem with those is once the time limit is done, and gravity pulls the ball, it comes down straight, no arch like a natural ball would.
Time limit ? Gravity ?
yes, with time limit, and gravity... oh! are you asking what's the time limit and amount of gravity?
Finally got it, copied the formula used in Angry Birds without the powerups and so on, using Change Velocity and vectorToAngle. @Socks thanks again.
@Socks
Here's the gameplay demo of the game I'm about to publish...
Looks very polished !
I like it polished lol