public DynamicObject(Position topLeft, char[,] texture, int speed, Direction direction) : base(topLeft, texture) { this.Speed = speed; this.state = this.Speed; this.ObjDirection = direction; }
// Ship can shoot public List<GameObject> Shoot(Direction direction) { List<GameObject> shoots = new List<GameObject>(); Position bulletPosition = new Position(0, 0); char bulletTexture = '|'; switch (direction) { case Direction.Top: bulletPosition.Row = this.TopLeft.Row - 1; bulletPosition.Col = (2 * this.TopLeft.Col + this.Width) / 2; bulletTexture = '|'; break; case Direction.TopRight: bulletPosition.Row = this.TopLeft.Row - 1; bulletPosition.Col = this.TopLeft.Col + 1; bulletTexture = '/'; break; case Direction.Right: bulletPosition.Row = (2 * this.TopLeft.Row + this.Width) / 2; bulletPosition.Col = this.TopLeft.Col + 1; bulletTexture = '-'; break; case Direction.DownRight: bulletPosition.Row = this.TopLeft.Row + 2; bulletPosition.Col = this.TopLeft.Col + 1; bulletTexture = '\\'; break; case Direction.Down: bulletPosition.Row = this.TopLeft.Row + 2; bulletPosition.Col = (2 * this.TopLeft.Col + this.Width) / 2; bulletTexture = '|'; break; case Direction.DownLeft: bulletPosition.Row = this.TopLeft.Row + 2; bulletPosition.Col = this.TopLeft.Col - 1; bulletTexture = '/'; break; case Direction.Left: bulletPosition.Row = (2 * this.TopLeft.Row + this.Width) / 2; bulletPosition.Col = this.TopLeft.Col + 1; bulletTexture = '-'; break; case Direction.TopLeft: bulletPosition.Row = this.TopLeft.Row - 1; bulletPosition.Col = this.TopLeft.Col - 1; bulletTexture = '\\'; break; default: break; } shoots.Add(new Bullet(bulletPosition,new char[,] { { bulletTexture } }, direction)); return shoots; }
public StaticObject(Position topLeft, char[,] texture) : base(topLeft, texture) { }
// Main abstract class for all objects public GameObject(Position topLeft, char[,] texture) { this.TopLeft = topLeft; this.Texture = texture; this.IsDestroyed = false; }
//Constructor public Ship(Position topLeft, char[,] texture, int speed, Direction direction, int life) : base(topLeft, texture,speed,direction) { this.Life = life; }
public Bullet(Position topLeft, char[,] texture, Direction bulletDirection) : base(topLeft, texture,0,bulletDirection) { this.ObjDirection = bulletDirection; }
public Rock(Position topLeft, char[,] body) : base(topLeft, body) { this.Lifetime = 100; }
//Constructor public EnemyShip(Position center, char[,] texture,Direction direction) : base(center, texture,5,direction,2) { this.ObjectPosition = center; }
// The Viking //changed viking outlook yoan public Viking(Position topLeft) : base(topLeft, new char[,] { {' ',' ','^',' ',' '}, {'-','[','*',']','-'}},0,Direction.Right,5) { }