Page 1 of 2
How can i do a level transition?
Posted: Sun Sep 22, 2013 12:53 am
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!
Re: How can i do a level transition?
Posted: Sun Sep 22, 2013 1:19 am
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.
Re: How can i do a level transition?
Posted: Sun Sep 22, 2013 1:47 am
by JackHide
Nice, thanks! One more doubt, I do this using love.filesystem?
Re: How can i do a level transition?
Posted: Sun Sep 22, 2013 2:36 am
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.
Re: How can i do a level transition?
Posted: Sun Sep 22, 2013 2:59 pm
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
Re: How can i do a level transition?
Posted: Sun Sep 22, 2013 6:24 pm
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
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
Re: How can i do a level transition?
Posted: Sun Sep 22, 2013 7:30 pm
by JackHide
Thanks, jjmafiae!
I'll try to implement it in my code!
One doubt, its works with tilemaps too?
Re: How can i do a level transition?
Posted: Sun Sep 22, 2013 8:19 pm
by jjmafiae
JackHide wrote:Thanks, jjmafiae!
I'll try to implement it in my code!
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.
Re: How can i do a level transition?
Posted: Sun Sep 22, 2013 9:23 pm
by JackHide
Ok, thanks again!
Re: How can i do a level transition?
Posted: Thu Sep 26, 2013 7:14 pm
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.