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

Endless Game


Chubby
 Share

Recommended Posts

Hi,

 

I am doing an endless game.

I have two options and I dont know which one is better (I will explain the pros/cons that I THINK each one have - I might be wrong, this is why I ask)

 

  1. my character goes down (y-=something) and I change the game.world.bounds.height - when something is out of bounds, it resets (to another position)
    Pros:
    • Easy to make the rest of the game, nothing is relative (you'll understand what I am talking about when I explain about the second option)
    Cons:
    • The game world height just keep getting bigger and bigger, is it keep being in the memory?
  2. everything goes up (group.addAll(y,something)) - when something is out of bounds, it resets (to another position)
    Pros:
    • What you see is what you get - you dont have extra or hidden elements
    Cons:
    • Too many elements are moving together - is it causing the game to be slower?
    • I need to calculate relative positions because everything is moving but the world is static.

 

I feel that the first solution is better unless what is hidden (out of bounds) is not in the memory aswell...

Else, I prefer option 2. It might be harder to develop but this way the momery will stay the same

Link to comment
Share on other sites

If the game is truly endless I'd go for method 2 - this is how endless games usually work. It seems like a bit of a pain to do it this way but the overhead in most cases is negligible - moving a camera down is in rendering terms exactly the same as moving sprites up; they get moved upwards on the screen.

 

I did a little jsFiddle recently demonstrating a simple infinite runner game mechanic: http://jsfiddle.net/lewster32/2e77q54s/

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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