Hi out there!
I am having some trouble with getting inside a function to change psysics body on element.
I need to change:
physics.addBody( angel, “kinematic”, …
to
“dynamic”
Can somebody tell me what i am doing wrong in my code?
function angel (a,b,c)
local angel = display.newImage("assets/angelTest.png")
angel.x, angel.y = a, b
angel.rotation = c
angel.name = "angel"
angelShape1 = { -30, -30 , -50, -50 , 50, -50 , 50, -30 }
angelShape2 = { -30, -30 , -30, 50 , -50, 50 , -50, -50 }
physics.addBody( angel, "kinematic",
{ density=3.0, friction=0.6, bounce=0.2, shape=angelShape1 },
{ density=3.0, friction=0.6, bounce=0.2, shape=angelShape2 }
)
end
angel(300,400, 0)
function onCollision( event )
if ((event.object1.name == "lou") and (event.object2.id == "evilRazorBalls") ) then
if ( event.phase == "began" ) then
print( "began: " .. event.object1.name .. " & " .. event.object2.name .. " - DIE " )
elseif ( event.phase == "ended" ) then
-- Nothing to do for now
end
end
if (event.object1.name == "angel") then
print("hit")
angel.bodyType = "dynamic"
end
end
[import]uid: 112262 topic_id: 29294 reply_id: 329294[/import]