Implementing levels

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Josh.G
Prole
Posts: 16
Joined: Thu Jul 29, 2021 6:16 pm

Re: Implementing levels

Post by Josh.G »

heres what my game is so far
Attachments
UntitledGame.love.zip
(4.9 MiB) Downloaded 160 times
User avatar
ReFreezed
Party member
Posts: 612
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

Re: Implementing levels

Post 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.
Attachments
UntitledGame.love
(4.83 MiB) Downloaded 154 times
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
Josh.G
Prole
Posts: 16
Joined: Thu Jul 29, 2021 6:16 pm

Re: Implementing levels

Post 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?
Josh.G
Prole
Posts: 16
Joined: Thu Jul 29, 2021 6:16 pm

Re: Implementing levels

Post by Josh.G »

Also i please ask that no one steal my game (not directed towards anyone, just a blanket statement)
User avatar
ReFreezed
Party member
Posts: 612
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

Re: Implementing levels

Post 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.)
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
Josh.G
Prole
Posts: 16
Joined: Thu Jul 29, 2021 6:16 pm

Re: Implementing levels

Post by Josh.G »

Thank you!
(this is my first time on a coding forum sorry lol)
Josh.G
Prole
Posts: 16
Joined: Thu Jul 29, 2021 6:16 pm

Re: Implementing levels

Post 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. :?
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Semrush [Bot] and 5 guests