Hi dyson,
i’m trying to use particle candy with mte for firing at sprites. I can get my player shooting properly, but I can’t seem to get any collision detection working.
No code errors – I just dont get any collisions, is this because my fire is ‘outside’ the mte engine?
Any ideas greatly appreciated, Greg
I Create my particle:
Particles.CreateParticleType (“Shots”,
{
imagePath = “torpedo.png”,
imageWidth = 32,
imageHeight = 32,
velocityStart = 500,
– velocityChange = 1,
fadeInSpeed = 1.5, – PER SECOND
rotationChange = 1000,
autoOrientation = false, – ROTATE TO MOVEMENT DIRECTION
killOutsideScreen = true,
lifeTime = 2000,
alphaStart = 1.00,
blendMode = “add”,
sounds = torpedo,
} )
Particles.PhysicsMaterial = { density = 0.75, friction = 0.5, bounce = 0, radius=16 }
Particles.PhysicsProperties ={ isFixedRotation = false, isSleepingAllowed = false, name=“photon” }
I add my emitter to my player:
Particles.CreateEmitter(“E1”, player.x, player.y, 0, false, true)
Particles.AttachParticleType(“E1”, “Shots”, 1, 5000,2000)
Particles.StartEmitter(“E1”)
I add a listener to my enemy:
physics.addBody( object, “static”, { density = 3.0, friction = 1.0, bounce = 0.1 } , {radius=400, isSensor = true})
object.collision = onenemyCollision
object:addEventListener( “collision”, object )
My collision listener:
function onenemyCollision(self,event)
if event.phase==“began” then
collisiontype = event.other.id
print ("Collision detected: "… collisiontype)
end
end