Jump to content

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

Link to comment
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);


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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