bobbaluba's Forum Posts

  • 3 posts
  • After watching this

    Subscribe to Construct videos now

    , I got some inspiration on how to improve my game. However, I have some trouble implementing it.

    I started creating actions like this:

    self.X = lerp(self.tweenStartX, self.tweenEndX, (time-self.tweenStart)/(self.tweenEnd-self.tweenStart))

    But this seems messy, especially if I want to do non-linear interpolation.

    Maybe there is some plugin/behaviour I can use, or a way I can define my own functions, so I can easily change the interpolation function once without having to do edit every place I use tweening?

    What is the cleanest solution?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I tried what you told me, but it didn�t work. Well, most of the time, that is. I�m guessing there is some kind of race condition.

    I tried delaying the call to setVelocity with 10 ticks, and it turned out to work. Out of curiosity, I tuned it down to 3, and the problem was back.

    I�m not sure how construct 2 uses box2d, but I am guessing that whenever an object is moved, a new box 2d body is created, but it isn�t created at once. You have to wait for the next box2d update. And so if you call setVelocity too early, you are setting the velocity on the old body.

  • I am basically trying to create a portal. I wan't to save the velocity, and restore it after setting the new position.

  • 3 posts