Re: Music Bar;Drawn
Posted: Sat Jun 26, 2010 12:31 pm
Well yeah, certainly. I just wondered why you were complicating things by setting the mouse position to two variables in the update function, instead of just doing it all in the draw function.Robin wrote:One pixel is still an awfully small piece of screen. As bartbes pointed out earlier, using an upper and lower bound is better.nevon wrote:What's wrong with:?Code: Select all
function love.draw() if love.mouse.getX() == 300 and love.mouse.getY() == 320 then love.graphics.rectangle(fill,260,260,100,40) love.graphics.setColor(255,255,255) end end
ExampleSomething like that.Code: Select all
function love.draw() local mouseX = love.mouse.getX() local mouseY = love.mouse.getY() if mouseX > 300 and mouseX < 310 and mouseY > 320 and mouseY < 330 then love.graphics.rectangle(fill,260,260,100,40) love.graphics.setColor(255,255,255) end end