Growler

Disable respawn on leaving viewport

Recommended Posts

I have a portion of the game when the camera follows an entity (a taxi), not the main player, as it moves across the screen. The taxi is of type game.VehicleEntity which extends me.Entity.

me.game.viewport.follow(entity, me.game.viewport.AXIS.BOTH);

As the entity moves left, the camera follows it, which is great. But it reaches a point when the screen fades out and respawns the entity in the center of screen and breaks the game.

1) If the viewport is following the entity, how is the engine determining that it is out of bounds?

2) How can I disable respawning if the entity "leaves" whatever bounds 

A video of the issue: 

@obiot @Parasyte

Share this post


Link to post
Share on other sites

@obiot @Parasyte I see, it's happening not because the Taxi is leaving the viewport, but because the mainPlayer entity standing there is left behind, which the viewport eventually leaves. So the question still stands: how can I disable the respawn/refresh if the player, or any entity, is out of bounds?

Share this post


Link to post
Share on other sites

2 more things :

* first your game is really looking awesome so far :)

* in the latest 6.0 version of melonJS we added a camera damping features that really help in smoothing camera movements

// set the camera to follow this renderable on both axis, and enable damping
me.game.viewport.follow(this, me.game.viewport.AXIS.BOTH, 0.1);

 

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.