Growler Posted August 30, 2018 Share Posted August 30, 2018 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 Quote Link to comment Share on other sites More sharing options...
Growler Posted August 30, 2018 Author Share Posted August 30, 2018 @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? Quote Link to comment Share on other sites More sharing options...
obiot Posted August 31, 2018 Share Posted August 31, 2018 well honestly.... I don't know..... I really don't see what would be causing that in melonJS. would you mind setting a breakpoint on the loadLevel function https://github.com/melonjs/melonJS/blob/master/src/level/LevelDirector.js#L208 so that we can see the call tree ? Quote Link to comment Share on other sites More sharing options...
obiot Posted August 31, 2018 Share Posted August 31, 2018 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); Quote Link to comment Share on other sites More sharing options...
obiot Posted September 3, 2018 Share Posted September 3, 2018 Hi, did you progress or find out what is happening ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.