This application is intended for android tablet, so my images are 128x128, and my sounds are .wav (I wanted .ogg, but the app I used kinda sucked).
My first question is:
Resizing, I'd like the code to be able to handle any resolution, half the screen the one image, and the other half the other one.
So:
- How can I change the app to fill "client" with the 2 images, no matter what the size of the screen?
- How do I make sure than the mouse click still happens on the right images?
- How do I get an object ja with ja.button ja.sound ja.x ja.y, rather than the stand alone variables to work?
Code: Select all
function love.load()
ja = love.graphics.newImage("ja.png")
jasound = love.audio.newSource("ja.wav")
jax = 0
jay = 0
nee = love.graphics.newImage("nee.png")
neesound = love.audio.newSource("nee.wav")
neex = 130
neey = 0
end
function love.draw()
love.graphics.draw(ja, jax, jay)
love.graphics.draw(nee, neex, neey)
end
function love.mousepressed(x, y, button)
if x > neex then
love.audio.play(neesound)
else
love.audio.play(jasound)
end
end