Sunburned Goose Posted April 16, 2014 Share Posted April 16, 2014 I want to transition the camera between two sprites but I don't want sudden movement. Anyone have success tweening the camera between to sprites? Link to comment Share on other sites More sharing options...
Sunburned Goose Posted April 16, 2014 Author Share Posted April 16, 2014 Here is a demo of the work. If you thrust the ship to the lower right, there is a planet that it will try to orbit. The camera will move from the ship to the planet when the ship enters it's sphere of influence. I want to make this transition smooth, as if the camera was lifting from the ship and landing on the planet, all the while keeping both objects within the camera's frame. http://pgl.tiedtheleader.com/ Link to comment Share on other sites More sharing options...
Sunburned Goose Posted April 17, 2014 Author Share Posted April 17, 2014 I ended up working this out tonight.// If my camera is already following a targetif (that.game.camera.target) { that.game.camera.follow(null); // Unfollow the target that.game.add.tween(that.game.camera).to( {x: pCenter.x - (that.game.camera.width / 2), y: pCenter.y - (that.game.camera.height / 2) }, 750, Phaser.Easing.Quadratic.InOut, true); // Move the camera to the center of a planet, adjusting for the camera being 'centered' at the top-left.} kctang and Nestor 2 Link to comment Share on other sites More sharing options...
luckylooke Posted May 6, 2014 Share Posted May 6, 2014 I was trying the demo but I didnt noticed camera position changes.. Link to comment Share on other sites More sharing options...
Recommended Posts