Jump to content

tween sprite position with camera follow


ste2425
 Share

Recommended Posts

Hi everybody. 

 

Ive got a simple sprite that im moving around using accelerationFromRotation. This all works grand so ive been experimenting with a jump effect. Like the original micro machines. 

 

So i perform this by tween the sprites y position

var bounce=game.add.tween(sprite);bounce.to({ y: sprite.y - 50 }, 200).to({ y: sprite.y}, 200);bounce.start(); 

This also works and gives the desired affect.

 

However im now getting the camera to follow the sprite. The problem is when i tween the sprite the camera also moves to follow it.

 

So my question what would the best way be to tween the sprite whilst the camera keeps following the sprites original position, which it returns back to. 

 

I tried unfollowing the sprite just before the tween then following it again in the on complete callback. This sort of works the sprite moves and the camera doesn't move with it. However when the camera follows again it jumps to the sprites location causing a jitter.

 

Hope that all makes sense trying to explain this as best as i can.

 

Thanks all.

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...