Hey. I’m new to coding and such, How do I limit my jumps for my character?. If i kinda tap alot on the screen it will go far upp away.
ball = display.newImage (“character.png”)
ball.x = 70
ball.y = 350
physics.addBody(ball, {friction = 2.5, bounce=0.2, radius=35 })
local function onScreenTouch( event )
if event.phase == “began” then
– make ball jump
ball:applyForce( 0, -15, ball.x, ball.y )
end
return true
end
Runtime:addEventListener( “touch”, onScreenTouch )
Thanks.
Oh and,…
Another question…
When my character gets controlled by the accelerometer and it tilts to much to either side. The character goes “off screen” and can’t get back. How do i make it when it goes off screen that it comes back to the other side. So if it would go all the way to left wall(
Thanks! [import]uid: 134147 topic_id: 23317 reply_id: 323317[/import]

