I'm working on a little project for Android.
When I realese a mouse button, I want the player character move 32 pixels and stop.
I'm trying something like the code below (only a example):
Code: Select all
function love.load() x,y,z,vel = 0,0,false,100 end function love.update(dt) if z == true then if x < y then x = x + vel * dt else z = false end end end function love.mousepressed() y = x + 32 end function love.mousereleased() z = true end function love.draw(dt) love.graphics.print("x: "..x,100,100) love.graphics.print("y: "..y,100,150) end
How to avoid this and have always 32 pixels no matter the vel value on fast and slow smartphones?
Sorry if someone asked this before, but I was unable to find it.
Thank you guys in advance!