Hello
Is is possible to change physic element during colision ??
I have code like this:
local function onLocalCollision( self, event ) if ( event.phase == "began" ) then if(event.other.name == "ball") then print ("GOOOOOOOL") teamLocal[1].player.x = 200 teamLocal[1].player.y = 200 p1ScoreText.text = "1"; end --print( self.name .. ": collision began with " .. tostring(event.other.name) ) elseif ( event.phase == "ended" ) then print( self.name .. ": collision ended with " .. tostring(event.other.name) ) end end
p1ScoreText.text = “1”; - is working
teamLocal[1].player.x = 200 - it is not working
teamLocal[1].player.y = 200 - it is not working
this is physics for player:
physics.addBody(value.player, "dynamic", { density=1, friction=0.8, bounce=0.2, radius=25 }) value.player.isFixedRotation=true value.player.linearDamping = 4
and this is my player
paddle = display.newImageRect(resourceFile, 80, 80) paddle.x = xcoordinate paddle.y = ycoordinate paddle.name = name
Greeting Thank You