Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

world bounds and physics following player


jimanji
 Share

Recommended Posts

Is it possible to make the world bounds and physics to follow the player? something similar to this inside the update loop (not exactly but similar):

this.game.world.setBounds(sprite.position.x - 500, sprite.position.y - 500, 2000, 2000);

I have been having some weird results with arcade physics enabled on my sprite. My end goal is to have the boundaries follow the player around, showing only objects within these bounds and killing off other things. Then I want to load map tiles into a group based on the sprites x and y positions and the proximity the tile is from the sprite. The concept would be similar to map chunking, but I want it to be closer to a tile instead of a grid. If it is not possible any alternative ideas would be appreciated. Also, has anyone had issues enabling physics on the sprite and not enable world bounds and the sprite fly off of the screen? Let me know if more info is needed. Thanks.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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