telecontrol

camera vs. object movement

Recommended Posts

I am working on a vertical scrolling shmup with phaser. Due to some special game mechanics I want the player not to appear centered but slighty down (like in space invaders). Phaser camera follow does not support offsetting the camera by defauit so I was wondering if it wouldnt' be easier to move the objects around rather than the camera in the game worl and keep the player and the hud elements in place. Is there a fundamental difference between the two methods?

 

Thx in advance

Share this post


Link to post
Share on other sites

In general, I think it's easier to keep the player static and move the objects around for scrolling games like the one you're describing.

If you wanted to move the player and have the camera follow, you could probably implement your own camera behavior by setting the game.camera.y position in the update function. You would offset that position from the player.y position by however much you wanted. Thus you could have the camera follow the player but not have the player in the middle.

Share this post


Link to post
Share on other sites

Thank you for the reply. Moving the objects seems to work except for a tilemapLayer. the tilemapLayer only renders the way it should if I move the camera. I will try to implement your offset suggestion.

Share this post


Link to post
Share on other sites
On 7/17/2017 at 6:01 AM, telecontrol said:

Due to some special game mechanics I want the player not to appear centered but slighty down (like in space invaders).

I think if you set a camera deadzone here it will be enough to make this work.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.