Can somebody help me correct this code so when i touch the screen to switch the linear velocity to the opposite of what it is.
charA:setLinearVelocity( 0, 250 ) local CharV = charA:getLinearVelocity() local function onObjectTouch( event ) if CharV \> -1 then charA:setLinearVelocity(0,250) else CharA:setLinearVelocity(0,-250) end end background:addEventListener( "touch", onObjectTouch )