fitness23 Posted November 22, 2016 Share Posted November 22, 2016 I understand you can make the camera follow a particular sprite but can you make the camera delay by 1 second before it starts following the sprite? Link to comment Share on other sites More sharing options...
WombatTurkey Posted November 22, 2016 Share Posted November 22, 2016 You can do setTimeout( (x) = > { game.camera.follow(sprite, 0, 0.1, 0.1); }, 1000); Link to comment Share on other sites More sharing options...
lewster32 Posted November 23, 2016 Share Posted November 23, 2016 Bear in mind the above will only delay when the camera starts following, once it's started there will no longer be a delay. If you want the camera to always be 1 second behind the sprite, you'll need to do something slightly different. A simple way to delay the camera behind a target is to use a smoothed camera follow routine such as this: https://jsfiddle.net/lewster32/e6cfnxbo/ To actually force a delay of 1 second (or an arbitrary length of time) is more tricky, not to mention would be quite jarring and unusual for the player. I can't think of a simple way to implement this - I don't think a timer would be the right way to go about it though. Link to comment Share on other sites More sharing options...
Recommended Posts