shohan4556 Posted September 28, 2015 Share Posted September 28, 2015 Hello everybody, In my game I want the game camera auto move up(continue going up forever) so I have tried something like this game.camera.y -=10; in update() function, but its not working. is there any way to make it ?Thanks. Link to comment Share on other sites More sharing options...
Noid Posted September 28, 2015 Share Posted September 28, 2015 That should work. Try adding game.camera.unfollow() at the end of your create function. If that works then you've set the camera to follow some sprite earlier in your code(it may happen if you're using some example/template as a starting point. Link to comment Share on other sites More sharing options...
MichaelD Posted September 28, 2015 Share Posted September 28, 2015 Have you seen this: http://phaser.io/examples/v2/camera/moving-the-camera ? Link to comment Share on other sites More sharing options...
shohan4556 Posted September 28, 2015 Author Share Posted September 28, 2015 That should work. Try adding game.camera.unfollow() at the end of your create function. If that works then you've set the camera to follow some sprite earlier in your code(it may happen if you're using some example/template as a starting point.It works only when I move my hero up otherwise not. I have an idea that is create an hidden sprite give it velocity.y -=value and make camera to follow it .but its not working. actually I follow this way http://codepen.io/shohan4556/pen/KdPVNd?editors=001 but the camera follow should going up forever automatically without respect the hero. Link to comment Share on other sites More sharing options...
Noid Posted September 28, 2015 Share Posted September 28, 2015 If you put game.camera.y -=10; in the update function in your games state it should go up 10px every frame. Link to comment Share on other sites More sharing options...
Recommended Posts