using System;
using Microsoft.DirectX.DirectDraw;
using Global;
using Global.GlobalClass;
using KillerInstinct.DirectX;
namespace KillerInstinct.Sprites{
public class MineClass : SpriteClass
{
public MineClass(string file, float x, float y)
{
frame.Width = 12;
frame.Height = 12;
framesCount = 1;
framesPerRow = 1;
layer = LAYER_POWERUP;
collisionType = CollisionType.Pixel;
Init(file, CONST.COLORKEY_WHITE, x, y);
}
public override void Update()
{
}
public override void ReactToCollision(SpriteClass s)
{
if (s.GetType() == typeof(ShotClass))
{
// only explode when hit by certain, POWERFUL shot types
switch (((ShotClass)s).ShotType)
{
case ShotClass.ShotTypes.Basic:
case ShotClass.ShotTypes.L2:
case ShotClass.ShotTypes.L3:
case ShotClass.ShotTypes.L4:
global.spriteList.Delete(this);
break;
}
}
else if (s.GetType() == typeof(TankClass))
{
global.spriteList.Delete(this);
// draw an explosion a little to the upper-left of the shot
global.spriteList.Add(new Sprites.ExplosionClass(CONST.BMP_EXPLOSION, posX-49, posY-49));
global.SC.Play(SoundClass.SOUND_EXPLOSION, false);
// take away some energy from tank who touched
s.Energy -= global.random(20, 30);
// stop their tank
s.speed = 0;
}
}
}
}
|