Page 1 of 1

i require a menu please ^^

Posted: Fri Dec 09, 2011 8:29 pm
by vt007
Wsup? ^^

I dont know how many of you know C but i will try to explain it simple:

How can i create different pages on screen in LOVE
(e.g. INTRO then MENUE then GAME then PAUSE etc)

in C its kinda easy, You just have to create 2 different .c files (e.g. main.c / menu.c / play.c etc)
then include them all together (where needed^^) and mark a key like this to blit it on "screen":

Code: Select all

[...]event.key.keysym.sym){
                    case SDLK_p:
                        options(screen);
                        break;
} [...]
then same stuff if you wanna go back...

So is there any way to do this in love2d?

thx ^^

PS: i tried to make a splashIntro as a big "fat" function in splashIntro.lua then include it in the main.lua
(e.g.
--main.lua
require("splashIntro")

function love.load()
splashIntro()
[...]
end
[...]
)
but it crashes and says me some weird stuff, idk... ^^"""
and in any case i dont even know how to FreeSurface it...

Re: i require a menu please ^^

Posted: Fri Dec 09, 2011 9:16 pm
by josefnpat
For anyone that doesn't like bright green on baby blue:
vt007 wrote:PS: i tried to make a splashIntro as a big "fat" function in splashIntro.lua then include it in the main.lua
(e.g.
--main.lua
require("splashIntro")

function love.load()
splashIntro()
[...]
end
[...]
)
but it crashes and says me some weird stuff, idk... """
and in any case i dont even know how to FreeSurface it...

Re: i require a menu please ^^

Posted: Fri Dec 09, 2011 9:28 pm
by vt007
that wasnt important dude ^^"" anyway... thx, i guess, to correct my misstakes ^^

Re: i require a menu please ^^

Posted: Fri Dec 09, 2011 9:39 pm
by TechnoCat
What you're asking for is some sort of game state management.
There are plenty of ways to do it (mostly involving some OOP solution).
Here is how I do mine: https://bitbucket.org/dannyfritz/blank-love/src

Re: i require a menu please ^^

Posted: Fri Dec 09, 2011 11:23 pm
by josefnpat
vt007 wrote:that wasnt important dude ^^"" anyway... thx, i guess, to correct my misstakes ^^
Actually, it was important, because I could not read it at all. Please stop using the color=#BFFFBF tag.

Re: i require a menu please ^^

Posted: Tue Dec 13, 2011 6:57 pm
by vt007
ok i mean, ok ^^ :crazy: