Using Lerp with 'Every tick'

0 favourites
  • 2 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • Hey All,

    I have a game setup so that when two variables match, I want a camera sprite (with a scroll-to behaviour) to lerp position to another object.

    Problem is, I can only get the Lerp working when i start with an 'Every tick'. If i place this at the start, then the movement occurs before the variables are checked. I just can't seem to fix it.

    Anyone have any suggestions please?

    To summarise:

    SYSTEM - COMPARE VARIABLES - VARa = VARb - LERP position.

    Thanks,

    BB.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Not sure I understand your issue.. You can add two instance variables to the Camera object - "targetX" and "targetY". Add this event:

    On every tick: Camera set position to lerp(self.x, self.y, self.targetX, self.targetY, dt*4)

    When varA=varB, set new values to targetX and targetY. And the camera will move automatically to the new position.

    .

    You can also move the camera with LiteTween addon and make some cool easing effects.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)