I have stick, which rotates when i move my finger to right of left. And there is ball on the stick and ball moves when stick rotates. But how i can do, that when ball moves, it rolls/spins? Now it just moves and it doesnt look very realistic. Please help me.
Here is code:
Stick:
local lauta = display.newImage ("lauta2.png")
lauta.x = display.contentWidth/2
lauta.y = display.contentHeight\*0.8
physics.addBody(lauta, "kinematic", {friction = 0})
localGroup:insert(lauta)
local max = math.max
local min = math.min
local centerX = display.contentWidth/2
local function rotate(event)
local r = centerX - event.x
r = min(r, 270)
r = max(r, -270)
lauta.rotation = r/9
end
Ball:
[code]
local pallo = display.newImage (“basketball2.png”)
pallo.x = display.contentWidth/2
pallo.y = display.contentHeight*0.65
pallo.isBullet = true
physics.addBody(pallo, {density = 500, bounce = 0, radius = 30, friction = 0})
localGroup:insert(pallo) [import]uid: 18445 topic_id: 7098 reply_id: 307098[/import]