Page 1 of 1
Trying to make my own menu(issues)
Posted: Sun Sep 27, 2015 6:03 pm
by NewReasonz
I try to make my own menu in lua2d, and with menu i mean diffrent gamestates

. For example: When the Gamestate is "Menu" the menu should show up, if the Gamestate is "Playing", the game should start. I found some examples in the amazing internet, but i had my own idea, which doesn´t work as planned

.
i would really appreciate it, if someone could tell me what i do wrong.
Ps: Iam new to love2d, so excuse me if it´s a stupid mistake

.
Re: Trying to make my own menu(issues)
Posted: Sun Sep 27, 2015 6:59 pm
by Jack5500
-snip-
Re: Trying to make my own menu(issues)
Posted: Sun Sep 27, 2015 7:06 pm
by 0x72
you never load the menu again (only changing state) and you have some initialization (for player) in the LOAD_MENU in case of
so try:
Code: Select all
function StateChanger(dt)
if love.keyboard.isDown("1") and State == "Menu" then
State = "Playing"
LOAD_MENU(dt)
end
end
good luck with the game
just a suggestion, feel free to ignore:
move the string (e.g. "Playing") as an argument of this LOAD_MENU (LOAD_STATE name maybe? and why so uppercase anyway?) and set the state inside it, so you never again set the state but not initialize it.
Re: Trying to make my own menu(issues)
Posted: Sun Sep 27, 2015 7:33 pm
by NewReasonz
0x72 wrote:you never load the menu again (only changing state) and you have some initialization (for player) in the LOAD_MENU in case of
so try:
Code: Select all
function StateChanger(dt)
if love.keyboard.isDown("1") and State == "Menu" then
State = "Playing"
LOAD_MENU(dt)
end
end
good luck with the game
just a suggestion, feel free to ignore:
move the string (e.g. "Playing") as an argument of this LOAD_MENU (LOAD_STATE name maybe? and why so uppercase anyway?) and set the state inside it, so you never again set the state but not initialize it.
Thank you so much! Works perfect now

. And why uppercase? Don´t know...because of something
