What I have is a menu and 2 buttons that upon hover state I wish to play audio. I have it so that the audio plays. However, it is on somewhat of a default loop. See the problem here is that while still hovering it continues to play. I dont know how to make it so that upon FIRST hover it plays and then stops if still hovering.
This is not a
Code: Select all
Source:setLooping(loop)
This is the code I have (please bare with me I am new) and I realize that this may not be correct (obviously it isnt or I wouldnt be asking.)
Code: Select all
local function drawButton(off, on, x, y, w, h, mx, my)
local ins = insideBox( mx, my, x - (w/2), y - (h/2), w, h )
if ins then
love.graphics.draw( on, x, y, 0, 1, 1, (w/2), (h/2) )
else
love.graphics.draw( off, x, y, 0, 1, 1, (w/2), (h/2) )
end
if not once and (ins) then
love.audio.play(src2)
once = true
elseif once and (ins) then
once = false
end
end