src/shot.js
/*
 * Explosion object.
 *
 * Spawn properties:
 * position: vec2 position
 * radius: float explosion radius
 */
Explosion object.
Spawn properties:
position: vec2 position
radius: float explosion radius
Explosion object . Spawn properties : position : vec2 position radius : float explosion radius
function Explosion(game, args) {
	var body = new p2.Body({
		position: args.position,
	});
	var shape = new p2.Circle({
		radius: args.radius,
		sensor: true,
	});
	if (args.isEnemy) {
		shape.collisionGroup = physics.Mask.Enemy;
		shape.collisionMask = physics.Mask.Player;
	} else {
		shape.collisionGroup = physics.Mask.Player;
		shape.collisionMask = physics.Mask.Enemy;
	}
	setTeam(shape, args.isEnemy);
	body.addShape(shape);
	this.body = body;
	this.state = 0;
	this.damage = args.damage;
}
function Explosion ( game , args ) { var body = new p2 . Body ( { position : args . position , } ) ; var shape = new p2 . Circle ( { radius : args . radius , sensor : true , } ) ; if ( args . isEnemy ) { shape . collisionGroup = physics . Mask . Enemy ; shape . collisionMask = physics . Mask . Player ; } else { shape . collisionGroup = physics . Mask . Player ; shape . collisionMask = physics . Mask . Enemy ; } setTeam ( shape , args . isEnemy ) ; body . addShape ( shape ) ; this . body = body ; this . state = 0 ; this . damage = args . damage ; }
Explosion object.
Explosion object .