How can i do a level transition?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
JackHide
Prole
Posts: 7
Joined: Sun Sep 22, 2013 12:33 am
Location: Porto Alegre - Brazil

How can i do a level transition?

Post by JackHide »

Hello lovers,

Im noob here and i have a doubt, how can I do to load the next level when the character of my
game arrives at the end of current level?

Thanks! ^^
User avatar
adnzzzzZ
Party member
Posts: 305
Joined: Sun Dec 26, 2010 11:04 pm
Location: Porto Alegre, Brazil

Re: How can i do a level transition?

Post by adnzzzzZ »

Have a Level class that holds most of the logic of how your game works. Create an instance of that Level to play in it and when you have to transition just create another instance and store or delete the first one.
User avatar
JackHide
Prole
Posts: 7
Joined: Sun Sep 22, 2013 12:33 am
Location: Porto Alegre - Brazil

Re: How can i do a level transition?

Post by JackHide »

Nice, thanks! One more doubt, I do this using love.filesystem?
User avatar
adnzzzzZ
Party member
Posts: 305
Joined: Sun Dec 26, 2010 11:04 pm
Location: Porto Alegre, Brazil

Re: How can i do a level transition?

Post by adnzzzzZ »

If you want to be able to store the state of a level after you left (such as enemies killed, items picked up/destroyed) so that when you load it again that state is also loaded (instead of rebuilding the whole level again), then yes. Otherwise you can just do it without saving anything and consequently without using the filesystem.
User avatar
JackHide
Prole
Posts: 7
Joined: Sun Sep 22, 2013 12:33 am
Location: Porto Alegre - Brazil

Re: How can i do a level transition?

Post by JackHide »

Ok, thanks!

Can you tell me what function i use to this without filesystem, or show me a example?

Sorry, im very noob, i have no ideia how to do this :ultraglee:
jjmafiae
Party member
Posts: 1331
Joined: Tue Jul 24, 2012 8:22 am

Re: How can i do a level transition?

Post by jjmafiae »

JackHide wrote:Ok, thanks!

Can you tell me what function i use to this without filesystem, or show me a example?

Sorry, im very noob, i have no ideia how to do this :ultraglee:

Code: Select all

map = "map1" --the current map

mapTable = {}

function map_add(name,picture)
      table.insert(mapTable,{name = name,picture = picture})
end

--this function draws the map(s)
function map_draw()
      for i,v in ipairs(mapTable) do
            if v.x == map then
                   love.graphics.draw(v.picture,0,0)
            end
      end
end

--the list of maps
function map_list()
        function map_add("map1",pic1)
        function map_add("map2",pic2)
end
in order to understand this simple example you need to know how to draw and load a picture and also know how to use "tables".

also dont give up, just try something easier :)
User avatar
JackHide
Prole
Posts: 7
Joined: Sun Sep 22, 2013 12:33 am
Location: Porto Alegre - Brazil

Re: How can i do a level transition?

Post by JackHide »

Thanks, jjmafiae!

I'll try to implement it in my code! :D

One doubt, its works with tilemaps too?
jjmafiae
Party member
Posts: 1331
Joined: Tue Jul 24, 2012 8:22 am

Re: How can i do a level transition?

Post by jjmafiae »

JackHide wrote:Thanks, jjmafiae!

I'll try to implement it in my code! :D

One doubt, its works with tilemaps too?
i think you can modify my code to work with tile maps, but i have nearly never used tile systems myself.
User avatar
JackHide
Prole
Posts: 7
Joined: Sun Sep 22, 2013 12:33 am
Location: Porto Alegre - Brazil

Re: How can i do a level transition?

Post by JackHide »

Ok, thanks again! :D
User avatar
Diehl
Prole
Posts: 29
Joined: Tue Aug 27, 2013 10:53 am
Contact:

Re: How can i do a level transition?

Post by Diehl »

Hello!

I am one of the people who are working with Jack in this game.

But we do not know really make a game. So we would like to know how we can do to add more levels in our game.

We have several versions of the game, each with a different level, but we do not know how to put it all together, do not know how to identify the player reached the end of the level, not as we do to end a level and start again.

Is there a simple way to do this?

Thank you for your attention.
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests