How to create an endless runner? Static background.

ohtukrwohtukrw Sir dogeMember Posts: 106

I am trying to make an endless runner type of game. Tried moving background relative to the hero, which made the game lagg. Is it possible to move the hero relative to the background and make the background to appear looping instead of staying the same? I was trying out the control camera, which I have no idea how it works :(

Comments

  • ohtukrwohtukrw Sir doge Member Posts: 106

    What kind of games do you create :/

  • BBEnkBBEnk Member Posts: 1,764

    The way I make a endless runner is to make the scene say 10000 px long and move the camera with player, all the ground stuff doesn't move at all just leapfrogs back, and can be set to non-movable which is a big plus. and then I move the background forward to crate a parallax effect, and when player reaches say 8500 px I move everything on scene back to say 1500 px and it all just keeps looping over and over.

    This is not my original idea got it from another user here on forums long ago forget who but it works fantastic once you figure it all out.

  • ohtukrwohtukrw Sir doge Member Posts: 106

    @BBEnk said:
    The way I make a endless runner is to make the scene say 10000 px long and move the camera with player, all the ground stuff doesn't move at all just leapfrogs back, and can be set to non-movable which is a big plus. and then I move the background forward to crate a parallax effect, and when player reaches say 8500 px I move everything on scene back to say 1500 px and it all just keeps looping over and over.

    This is not my original idea got it from another user here on forums long ago forget who but it works fantastic once you figure it all out.

    Can you upload an example please. Also why do you make it that long instead of one image with the same technique?!

  • IceboxIcebox Member Posts: 1,485

    You can try it this way if you want , i think its like yours but i dont see any lag

  • ohtukrwohtukrw Sir doge Member Posts: 106

    @Icebox said:
    You can try it this way if you want , i think its like yours but i dont see any lag

    That's nice, could you explain how this works? Is the cube the only one that is moving?

  • IceboxIcebox Member Posts: 1,485

    @ohtukrw said:
    That's nice, could you explain how this works? Is the cube the only one that is moving?

    The demo is attached , the cube is not moving , its just going few pixels front and few pixels back using cosine function, the ground / trees / clouds are moving to the left , and i change their position to loop again once they are off screen. There is no lag when i test it on device, so i think your method works fine.

Sign In or Register to comment.