Page 1 of 1

Need some help with moving levels maps (SGDK)

Posted: Mon May 11, 2020 10:22 am
by Munkyears
Hi Guys!

So im slowly working my way through my projects but I'm having some creation issues.

I need some help from those who have already completed or finished a large proportion of their games design.
Im having trouble understanding how to load levels and move to the next one.

For example: My current project is a top down rpg. I want reach a position in the level and then load another level/map however I cant wrap my head around breaking this up within my code.

It seems quite trivial however i dont understand how i can make this work.

I have several levels completed and was thinking of having these seperated via cases in my code (in memory they are split into tiles so i can copy them rather than replicating the same) however it seems very carthartic and im unable to actually write a trigger for the transition from map one to map two.

Does anyone have some example code they would be willing to share?
I want something very similar to how Goof Troop handles this but cannot understand without some guidance!

Many thanks for the help!
Joseph

Re: Need some help with moving levels maps (SGDK)

Posted: Mon May 11, 2020 5:45 pm
by cero
I usually structure the main loop like this.

Code: Select all

level = 1;

while (1) {
  loadLevel();
  play();
}
So if you move to level 2, "level = 2; break out of game loop; fade out, etc etc".