Trying to make my own menu(issues)

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
NewReasonz
Prole
Posts: 3
Joined: Sun Sep 27, 2015 5:13 pm

Trying to make my own menu(issues)

Post by NewReasonz »

I try to make my own menu in lua2d, and with menu i mean diffrent gamestates :cool: . 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 :roll: .

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 :crazy: .
Attachments
Examples.rar
The .lua files
(958 Bytes) Downloaded 110 times
The error :/
The error :/
Error.PNG (19.71 KiB) Viewed 2174 times
User avatar
Jack5500
Party member
Posts: 148
Joined: Wed Dec 07, 2011 8:38 pm
Location: Hamburg, Germany

Re: Trying to make my own menu(issues)

Post by Jack5500 »

-snip-
Last edited by Jack5500 on Sun Sep 27, 2015 7:51 pm, edited 1 time in total.
User avatar
0x72
Citizen
Posts: 55
Joined: Thu Jun 18, 2015 9:02 am

Re: Trying to make my own menu(issues)

Post 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

Code: Select all

State == "Playing"
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.
NewReasonz
Prole
Posts: 3
Joined: Sun Sep 27, 2015 5:13 pm

Re: Trying to make my own menu(issues)

Post 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

Code: Select all

State == "Playing"
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 :awesome:. And why uppercase? Don´t know...because of something ;)
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 8 guests