Hey guys, basically I have a variable called ‘Size’ which holds values in increments of 1.
What Im trying to do is to change a weight velocity of the character dependant on the value held in the size variable.
Here is what I have:
local size = 1
And the set up for the player flying function.
function activateFly(event) ship:applyForce(0, -2.5, ship.x, ship.y) end
What I intend to do is something like this (code below is just an example)
function activateFly(event) if 'size' == 1 then ship:applyForce(0, -2.5, ship.x, ship.y) elseif 'size' == 2 then ship:applyForce(0, -0.5, ship.x, ship.y) end end
this is the function which calls the activateFly function
function touchScreen(event) print("touch") if event.phase == "began" then ship.enterFrame = activateFly Runtime:addEventListener("enterFrame", ship) end if event.phase == "ended" then Runtime:removeEventListener("enterFrame", ship) end end
Thanks in advance.