Page 2 of 2

Re: Implementing levels

Posted: Mon Aug 09, 2021 5:08 pm
by Josh.G
heres what my game is so far

Re: Implementing levels

Posted: Mon Aug 09, 2021 6:19 pm
by ReFreezed
One thing at a time. I've edited main.lua so there's a concept of being a "current level" among a "list of levels", and there's a way to start a new level.

I also made some smaller edits, like rearrange the order that things happens in in love.update() (first react to input, then update physics, and finally update the camera's position) which will fix the one-frame delay for things.

I hope it helps a bit.

Re: Implementing levels

Posted: Tue Aug 10, 2021 12:20 am
by Josh.G
Thank you! That was very helpful, however I have 1 question, for the EndRectangle function, if I was to have a level 3,4,5... so on would i need to change the name of the EndRectangle function? or how would that work for other levels?

Re: Implementing levels

Posted: Tue Aug 10, 2021 12:26 am
by Josh.G
Also i please ask that no one steal my game (not directed towards anyone, just a blanket statement)

Re: Implementing levels

Posted: Tue Aug 10, 2021 3:44 am
by ReFreezed
EndRectangle function? Do you mean the endRectangle table? Right now every level has its own endRectangle table. There's an assumption in the code that every level only has one exit (you could make 'endRectangle' into an array just like 'platforms' and 'dangerZones' to get multiple exits), and that the exit always leads to the next level (currentLevelIndex tells us what the current level is, so currentLevelIndex+1 is the next level).

(Also, don't worry about anyone "stealing" your game. It's not in anyone's interest.)

Re: Implementing levels

Posted: Tue Aug 10, 2021 3:17 pm
by Josh.G
Thank you!
(this is my first time on a coding forum sorry lol)

Re: Implementing levels

Posted: Wed Aug 11, 2021 11:22 pm
by Josh.G
Ok so, I got down the levels, now i need to do the save data and the level page, which i still dont know how to do. :?