1 decade ago by stahlmanDesign
@joncom - about this post I made from 2 years ago:
I never came up with a solution, but I can imagine it as an array of arrays containing levels that if put side by side would appear seamless:
If you start at level c3, when the character gets to the left edge of that level, he runs into a loadLevel entity which loads level c2. The important part is passing the player coordinates and velocity to a global object in main.js (probably) so when level c2 is rendered, the player is at the same pos.y, but if moving left, the pos.x is on the right side of the level moving into.
In your levels you might have the player entity somewhere, but this would always be overridden if the player were entering from the top or side. That logic I would probably have in main.js
I have a giant world map that's 7168 x 6912 pixels. That's 7x9 iPad screens. It's too big, and that makes it slow, so I was thinking of breaking it up into regions that would load like a new level. But since I want it to be seamless, I want to be able to transition to the new level at any horizontal or vertical point. That means when the new level is loaded, I want the character to start at a specific point depending on how he came in. It doesn't work to have one fixed starting point, because you can enter the level from many different directions.
How should I deal with this?
I never came up with a solution, but I can imagine it as an array of arrays containing levels that if put side by side would appear seamless:
[ [a0,a1,a2,a3,a4,a5], [b0,b1,b2,b3,b4,b5], [c0,c1,c2,c3,c4,c5], [d0,d1,d2,d3,d4,d5], [e0,a1,e2,e3,e4,e5] ]
If you start at level c3, when the character gets to the left edge of that level, he runs into a loadLevel entity which loads level c2. The important part is passing the player coordinates and velocity to a global object in main.js (probably) so when level c2 is rendered, the player is at the same pos.y, but if moving left, the pos.x is on the right side of the level moving into.
In your levels you might have the player entity somewhere, but this would always be overridden if the player were entering from the top or side. That logic I would probably have in main.js