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 .
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.
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