Super simple example, though as budershank suggested you are much more likely to get help if you provide more information.
[lua]-- Set up physics
require ( “physics” )
physics.start()
physics.setGravity( 0, 9.5 )
–Jump poewr variable
local jumpPower = 0
–Create static ground
local ground = display.newRect( 0, 460, 320, 80 )
physics.addBody(ground, “static”)
–Create dynamic player
local player = display.newRect( 140, 420, 40, 40 )
physics.addBody(player, “dynamic”)
player.isFixedRotation = true
–Jump button
local jumpBtn = display.newCircle(280, 40, 20)
–Jump function
local function jump(event)
if event.phase == “began” then
jumpTimer = timer.performWithDelay(100, function()
jumpPower = jumpPower + 1
end, 0)
elseif event.phase == “ended” then
timer.cancel(jumpTimer)
print (jumpPower)
player:applyForce(0,-jumpPower)
jumpPower = 0
end
end
jumpBtn:addEventListener(“touch”, jump)[/lua]
Peach [import]uid: 52491 topic_id: 30906 reply_id: 123637[/import]