Speed up Actor over Time

TouchTiltGamesTouchTiltGames Member Posts: 1,162
edited November -1 in Working with GS (Mac)
Tried to find the answer in the forums - Just trying to speed up an actor over time.

So I've got a game.speed (interger) attribute and I want it to speed up by +5 every 15 seconds or so.

on the actor I've got change attribute game.speed to game.speed+5
but how do I define speed? I tried a Rule if game.speed +5 then accelerate....

Comments

  • RHRH Member Posts: 1,079
    Maybe you should try using interpolate and use the self.motion.X for controlling the actors 'speed' (note that self.motion.X actually refers to velocity which is a vector value).

    I'd do something like this:

    - create a self.previousXvel (integer attribute)

    image

    This will give you a smooth increase in the speed (looking like a temporary acceleration).

    Obviously the timing you can alter and the first 'change attribute' is `change to self.motion.X'
  • TouchTiltGamesTouchTiltGames Member Posts: 1,162
    Hey RH, thanks a lot for this.

    Yeah I was trying to get it to accelerate in any direction, so I tried your example but seemed to go pretty nuts on the x and y and doesn't speed up over time lol. Here's what I have:

    every 1 second
    change self.speedup to self.motion.linear velocity.X
    change self.speedup to self.motion.linear velocity.Y

    interpolate self.motion.linear.X to self.speedup+25
    interpolate self.motion.linear.Y to self.speedup+25
  • TouchTiltGamesTouchTiltGames Member Posts: 1,162
    Bumping this up to ask someone else if they know how to speed up an actor over time using Interpolate? I must be close...
  • ORBZORBZ Member Posts: 1,304
    have you tried using accelerate behavior? it seems the obvious choice.

    However, if for some reason you want to "roll your own" acceleration behavior:

    http://en.wikipedia.org/wiki/Equations_of_motion
  • XizaxXizax Member Posts: 46
    if you are wanting to speed up continuously I have a bit of code I use to speed up over a rising attribute `[IMG]http://i54.tinypic.com/30dbghv.jpg[/IMG]` `[IMG]http://i56.tinypic.com/k30rut.jpg[/IMG]` i really hope this doesn't show up as code and as a pic instead. :P
  • RedlerTechRedlerTech Member Posts: 1,583
    This post is over 9 months old... I think he/she figured out the issue.
Sign In or Register to comment.