Timer-based Movement - { Tween }?

So I’m trying to get my game to run as efficiently as possible & I’ve run into quite the snag. How do I tween my Character’s move speed as well as animation speed & camera movement speed? I for some reason get some quirkiness that involves the camera ‘lagging’ for a second & I have a feeling it’s because I’m not using Timer based Movement.

anyone can help?

Can you show some code or an example? https://codepen.io/pen?template=YeEWom

Probably you don’t need to tween the camera movement speed, just following the character would be enough.

@samme of course! :slight_smile:

Here’s some code I uploaded to Github :

Here’s the file that controls the player :

Specifically, Line{s} 129-224

Increase the lerp values: https://github.com/Thundros/simple-platformer/blob/50852dd85d2b21ff99ea4141e183f07785c6c358/src/js/platformer-scene.js#L125

You can also temporarily remove the camera deadzone or camera bounds to see if those are causing trouble.

@samme Yea but I need a smooth camera. Not 1 that is snapped to the Player. Also, the character movement & animation speed, how do I tween the character movement & animation speed?

I couldn’t get the example to run, but if the camera isn’t moving how you want, usually you would adjust the lerp, deadzone, and bounds.

Character movement is by velocity or acceleration. If you’re using acceleration then keep doing that.

I think you can adjust sprite.anims.currentAnim.frameRate while the animation is playing. Probably you would set that based on the player’s current velocity, not tween it.

Try it again. I think I fixed the repo. I noticed I made a few typos. I just need my character to smoothly move as well as animate.

i adjusted the lerp deadzone & bounds. to no avail…