#
# Collision event handler for "monster4 projectile"
#

Object	obj = getThisObject();
Object	other = getOtherObject();

if (other == null)	# tile collision
{
	destroyObject(obj);
}
else			# object collision
{
	if (other == getHero())
	{
		destroyObject(obj);
		
		float	a = 0.0;
		int	x = getObjectXPosition(other) + 16;
		int	y = getObjectYPosition(other) + 16;
		while (a < 360.0)
		{
			createParticleObject(makeCode("par1"), x, y, a, 3.0,60);
			createParticleObject(makeCode("par1"), x, y, a, 4.0,60);
			a = a + 25.0;
		}
		
		Object	glass = createObject(makeCode("nikg"), x - 16, y - 16);
		setObjectLife(glass, 300);
		createPhysicsController(glass);
		copyObjectOrientation(glass, other);
		setObjectGravity(glass, 0.2);
		setObjectBounce(glass, 0.8);

		loseLife();
	}
}

