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: 491
Joined: Mon Nov 21, 2011 7:05 am
Location: Oregon, USA
Contact:

Main Menu

Post by baconhawka7x »

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 »

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: 491
Joined: Mon Nov 21, 2011 7:05 am
Location: Oregon, USA
Contact:

Re: Main Menu

Post by baconhawka7x »

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 »

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 »

User avatar
baconhawka7x
Party member
Posts: 491
Joined: Mon Nov 21, 2011 7:05 am
Location: Oregon, USA
Contact:

Re: Main Menu

Post by baconhawka7x »

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 »

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: No registered users and 68 guests