Jump to content

Endless Sidescroller


Recommended Posts



I just started using Phaser/GameDev and was wondering how one would build an 2d endless runner/sidescroller. If I'm not mistaken the Bounds are by default set to the size of the canvas. How and when would I procedurally add new grounds and obstacles? What about the Bounds? And how can I make the camera follow my player while keeping the player on the left side of the screen?  


Also: is there a way to search the Docs? Or even a Package/Source for Dash.app?

Link to comment
Share on other sites

Seems like the only way to me now its been said. I'd have probably made the bounds huge and then struggled with the random obstacles etc etc. BUT since the game is technically still and the player is animated to look like moving, and the level comes at the static player randomly, it would appear to make much more sense and a lot more reliable to code and modify. :)

Link to comment
Share on other sites

  • 8 months later...

Hi guys, is this concept of world moving around the player rather than player moving around the world good for mario style games?

How for example would you handle enemies appearing/ disappearing when player moves through the world? lets say i want my enemy to persist in game even when player

or enemy moves apart from each other? i would like to simulate enemy move across the world so when i go back/front with player enemy may be in completely different place.

Hope that you understand what i'm trying to achieve. 

Link to comment
Share on other sites

This is where separation of rendering from logic comes in. The 'treadmill' concept is actually how many scrolling games work (I made a simple example here a while back) and certainly how an endless runner should be done - the player stays still and the world is scrolled past them. Then the developer can choose to either only track objects on the screen and close to the edges off-screen, or track all of the objects in the world but only render those visible on screen. The former option means objects that leave the screen will be reset (this is what causes weird stuff like the traffic in older Grand Theft Auto games being different every time you look the other way) but is faster, whereas the latter option ensures consistency. Other options could be to stop updating objects off-screen, or update them less frequently, or make the 'safe area' where objects exist larger so the resetting issue becomes less obvious.

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...