Hi All -
Does anyone know of a good class for making a JUMP button for a mario brothers type game?
Thanks!!
D
Label: corona android iphone ipad building error inmobi problem display screen View image tableView failed object physics touch button game lua config event listener |
Hi All -
Does anyone know of a good class for making a JUMP button for a mario brothers type game?
Thanks!!
D
there's plenty of discussions about that on forums, please use search)
its very basic function by the way
@danimaltex were here is an example of a jump button
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | local onTouch = function(event) if ball.canJump then ball:applyLinearImpulse(0, -5, ball.x, ball.y) end end Runtime:addEventListener("tap", onTouch) local function onCollision(self, event ) if ( event.phase == "began" ) then if event.other.stage then ball.canJump = true end elseif ( event.phase == "ended" ) then if event.other.stage then ball.canJump = false end end end ball.collision = onCollision ball:addEventListener( "collision", ball ) |