Main Menu

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
User avatar
baconhawka7x
Party member
Posts: 484
Joined: Mon Nov 21, 2011 7:05 am
Contact:

Main Menu

Post by baconhawka7x » Tue Nov 22, 2011 10:52 pm

I've been making progress on my game. But i just need to know one thing. How do I make a button? sorry im a little new but all help is very appreciated!

User avatar
josefnpat
Inner party member
Posts: 955
Joined: Wed Oct 05, 2011 1:36 am
Location: your basement
Contact:

Re: Main Menu

Post by josefnpat » Tue Nov 22, 2011 11:14 pm

Well, you would draw the button, and if your love.mousepressed x's and y's are within the correct ranges, consider that the "button click" event.
Missing Sentinel Software | Twitter

FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push

User avatar
baconhawka7x
Party member
Posts: 484
Joined: Mon Nov 21, 2011 7:05 am
Contact:

Re: Main Menu

Post by baconhawka7x » Tue Nov 22, 2011 11:26 pm

josefnpat wrote:Well, you would draw the button, and if your love.mousepressed x's and y's are within the correct ranges, consider that the "button click" event.
How would i do that? lol sorry..im not the best..

User avatar
josefnpat
Inner party member
Posts: 955
Joined: Wed Oct 05, 2011 1:36 am
Location: your basement
Contact:

Re: Main Menu

Post by josefnpat » Tue Nov 22, 2011 11:50 pm

baconhawka7x wrote:
josefnpat wrote:Well, you would draw the button, and if your love.mousepressed x's and y's are within the correct ranges, consider that the "button click" event.
How would i do that? lol sorry..im not the best..
well, to draw the button you would use love.graphics.draw()
then in the function love.mousepressed() you would have to say:

Code: Select all

if x > button.x and
x < button.x + button.img:width and 
y > button.y and
y < button.y + button.img:height then
  --button action
end
Missing Sentinel Software | Twitter

FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push

User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: Main Menu

Post by TechnoCat » Wed Nov 23, 2011 12:01 am


User avatar
baconhawka7x
Party member
Posts: 484
Joined: Mon Nov 21, 2011 7:05 am
Contact:

Re: Main Menu

Post by baconhawka7x » Wed Nov 23, 2011 5:55 am

well, to draw the button you would use love.graphics.draw()
then in the function love.mousepressed() you would have to say:

Code: Select all

if x > button.x and
x < button.x + button.img:width and 
y > button.y and
y < button.y + button.img:height then
  --button action
end
[/quote]
thank you soooooo much!!!!

User avatar
josefnpat
Inner party member
Posts: 955
Joined: Wed Oct 05, 2011 1:36 am
Location: your basement
Contact:

Re: Main Menu

Post by josefnpat » Wed Nov 23, 2011 5:45 pm

baconhawka7x wrote:well, to draw the button you would use love.graphics.draw()
then in the function love.mousepressed() you would have to say:
josefnpat wrote:

Code: Select all

if x > button.x and
x < button.x + button.img:width and 
y > button.y and
y < button.y + button.img:height then
  --button action
end
thank you soooooo much!!!!
No problem, good luck on your game :)
Missing Sentinel Software | Twitter

FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 26 guests