Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function TABLE.createJump(posX)
- function jumpCollision(event)
- audio.play(jump_fx)
- event.other:applyForce(0, -15, event.other.x, event.other.x)
- event.target:play()
- timer.performWithDelay(30, function() event.other.onAir = true end, 10)
- end
- local data = require("assets.sprites.jump")
- local map = graphics.newImageSheet("assets/sprites/jump.png", data:getSheet() )
- local animations = {
- {name="normal", start=1, count=3, time=500, loopCount = 1, loopDirection = "bounce"},
- }
- local jump= display.newSprite( map, animations )
- _G.elements_group:insert(jump)
- jump.x = posX; jump.y = 370
- jump.type = "ground"
- jump:setSequence("normal")
- local shape = { halfWidth=10, halfHeight=32, x=0, y=-0, }
- physics.addBody(jump, "dynamic", {friction= 1, density= 200, box=shape})
- jump:addEventListener("collision", jumpCollision)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement