Need some help with moving levels maps (SGDK)

SGDK only sub forum

Moderator: Stef

Post Reply
Munkyears
Very interested
Posts: 54
Joined: Sat Mar 21, 2009 4:24 pm
Location: Sheffield, England

Need some help with moving levels maps (SGDK)

Post by Munkyears » Mon May 11, 2020 10:22 am

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
To be this good takes ages, To be this good takes Stef, Kanedafr, ChillyWilly & everyone who has helped me discover what hardwork is!

Dive into the SpritesMind! :)

cero
Very interested
Posts: 338
Joined: Mon Nov 30, 2015 1:55 pm

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

Post by cero » Mon May 11, 2020 5:45 pm

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

Post Reply