So guys i’m trying to create a explosion in my game, a found a tutorial and come up with this:
local function exploLission ( self, event) print(event.other.type) print(self.type) if(event.phase == "began") then local forcex = event.other.x-self.x local forcey = event.other.y-self.y-20 if(forcex \< 0) then forcex = 0-(60 + forcex)-12 else forcex = 60 - forcex+12 end event.other:applyForce( forcex, forcey, self.x, self.y ) end end local circle = display.newCircle( -100, -100, 60 ) physics.addBody(circle, "static", {isSensor = true, filter = filtroExplosoes}) circle.type = "circle" group:insert(circle) circle.collision = exploLission circle:addEventListener("collision", circle) local function criarExplosao(cirx, ciry) circle.x = cirx circle.y = ciry end criarExplosao(100, 100)
In my collision detector ( exploLission ), i manage to print out, the type of my circle, and the type of the other object, so the collision is being detected, but for some reason the event.other:applyforce, is being complete ignored.
event.other is a object in transition.to() does this matter?