I need help trying to set up a velocity that increases when player hits an object. I cannot get this to work, so wanted to see if I am doing this right, or whether corona/ LUA can do this.
The velocity is basically for the movement of the player. I just want it to start getting heavier.
Here is what I have:
global values
local size = 0
function update(event)
if(dir == 'up' and size \<2) then ship:setLinearVelocity(0, -200) elseif(dir == 'up' and size \>2)then ship:setLinearVelocity(0, -40) elseif(dir == 'left') then ship:setLinearVelocity(-100, 0) elseif(dir == 'right') then ship:setLinearVelocity(100, 0) end
function collisionHandler(e)
if(e.other.name == 'ship' and e.target.name == 'enemy') then display.remove(e.target) ship.width = ship.width +10 ship.height = ship.height +10 size = size +1 print("size 1") end
thanks.