Help me push a button with Love2D? (also uses Lua)
Hello, I am using Love2D Lua, instead of Roblox Lua, i am sorry if this breaks the rules but I need help, it is supposed to add 1 to the score when I push a circle known as "Button" can somebody help?
10 | myFont = love.graphics.newFont( 40 ) |
13 | function love.update(dt) |
18 | love.graphics.setColor( 1 , 0 , 0 ) |
19 | love.graphics.circle( "fill" , button.x, button.y, button.size) |
21 | love.graphics.setFont(myFont) |
22 | love.graphics.setColor( 1 , 1 , 1 ) |
23 | love.graphics. print (score) |
26 | function love.mousepressed( x, y, button, istouch ) |
28 | if distanceBetween(button.x, button.y, love.mouse.getX(), love.mouse.getY()) < button.size then |
35 | function distanceBetween(x 1 , y 1 , x 2 , y 2 ) |
36 | return math.sqrt((y 2 - y 1 )^ 2 + (x 2 - x 1 )^ 2 ) |