Exemplo n.º 1
0
 public DynamicObject(Position topLeft, char[,] texture, int speed, Direction direction)
     : base(topLeft, texture)
 {
     this.Speed = speed;
     this.state = this.Speed;
     this.ObjDirection = direction;
 }
Exemplo n.º 2
0
 // 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;
 }
Exemplo n.º 3
0
 public StaticObject(Position topLeft, char[,] texture)
     : base(topLeft, texture)
 {
 }
Exemplo n.º 4
0
 // Main abstract class for all objects
 public GameObject(Position topLeft, char[,] texture)
 {
     this.TopLeft = topLeft;
     this.Texture = texture;
     this.IsDestroyed = false;
 }
Exemplo n.º 5
0
 //Constructor
 public Ship(Position topLeft, char[,] texture, int speed, Direction direction, int life)
     : base(topLeft, texture,speed,direction)
 {
     this.Life = life;
 }
Exemplo n.º 6
0
 public Bullet(Position topLeft, char[,] texture, Direction bulletDirection)
     : base(topLeft, texture,0,bulletDirection)
 {
     this.ObjDirection = bulletDirection;
 }
Exemplo n.º 7
0
 public Rock(Position topLeft, char[,] body)
     : base(topLeft, body)
 {
     this.Lifetime = 100;
 }
Exemplo n.º 8
0
 //Constructor
 public EnemyShip(Position center, char[,] texture,Direction direction)
     : base(center, texture,5,direction,2)
 {
     this.ObjectPosition = center;
 }
Exemplo n.º 9
0
 // The Viking
 //changed viking outlook yoan
 public Viking(Position topLeft)
     : base(topLeft, new char[,] { {' ',' ','^',' ',' '}, {'-','[','*',']','-'}},0,Direction.Right,5)
 {
 }