this is my code at this point
[lua]local movePlayer = function()
xMotion = joystick.joyX
yMotion = joystick.joyY
if xMotion ~= false and yMotion ~= false then
xMotion = xMotion * 125
yMotion = yMotion * 125
playerObject:setLinearVelocity( xMotion , yMotion)
elseif xMotion == false or yMotion == false then
playerObject:setLinearVelocity( 0 , 0)
elseif xMotion ~= false and yMotion ~= false and isRunning == true then
xMotion = xMotion * 175
yMotion = yMotion * 175
playerObject:setLinearVelocity( xMotion , yMotion)
end
end
Runtime:addEventListener(“enterFrame”, movePlayer )
local makeRun = function( event )
if event.phase == “press” and event.id == “runbutton” then
isRunning = true
elseif event.phase == “release” and event.id == “runbutton” then
isRunning = false
end
end
local runBtn = ui.newButton{
default = “arrow.png”,
onEvent = makeRun,
id = “runbutton”
}
runBtn.x = midX + 100
runBtn.y = midY + 100[/lua] [import]uid: 19620 topic_id: 1632 reply_id: 56297[/import]