예제 #1
0
 public void moveRight(Entity[,] Pos, Air air)
 {
     if ((Pos[X + 1, Y] is Air) && (X + 1 <= 32) && (Body.Visible == true))
     {
         Body.Left = Body.Left + Body.Width;//(int)Math.Round(0.020 * Screen.PrimaryScreen.Bounds.Width + 8)
         Pos[X, Y] = air;
         X = X + 1;
         Pos[X, Y] = this;
         orientation = 2;
     }
 }
예제 #2
0
 public void moveLeft(Entity[,] Pos, Air air)
 {
     if ((Pos[X - 1, Y] is Air) && (X - 1 > 0) && (Body.Visible == true))
     {
         Body.Left = Body.Left - Body.Width;//(int)Math.Round(0.020 * Screen.PrimaryScreen.Bounds.Width + 8)
         Pos[X, Y] = air;
         X = X - 1;
         Pos[X, Y] = this;
         orientation = 4;
     }
 }
예제 #3
0
 public void moveDown(Entity[,] Pos, Air air)
 {
     if ((Pos[X, Y + 1] is Air) && (Y + 1 <= 16) && (Body.Visible == true))
     {
         Body.Top = Body.Top + Body.Height;//(int)Math.Round(0.082 * Screen.PrimaryScreen.Bounds.Height - 30)
         Pos[X, Y] = air;
         Y = Y + 1;
         Pos[X, Y] = this;
         orientation = 3;
     }
 }
예제 #4
0
 public void moveUp(Entity[,] Pos, Air air)
 {
     if ((Pos[X, Y - 1] is Air) && (Y - 1 > 0) && (Body.Visible == true))
     {
         Body.Top = Body.Top - Body.Height;//(int)Math.Round(0.082 * Screen.PrimaryScreen.Bounds.Height - 30)
         Pos[X, Y] = air;
         Y = Y - 1;
         Pos[X, Y] = this;
         orientation = 1;
     }
 }
예제 #5
0
        public void Move(Entity[ , ] Pos, Air air)
        {
            switch (orientation)
            {
            case 1:
                if (Pos[X, Y - 1] is Air && Y - 1 > 0)
                {
                    Pos[X, Y - 1] = this;
                    Body.Top      = Body.Top - air.Body.Height / 16;//(int)Math.Round(0.095 * Screen.PrimaryScreen.Bounds.Height - 30)
                    Y             = Y - 1;
                    Pos[X, Y + 1] = air;
                }
                else
                {
                    Body.Visible = false;
                }
                if (Pos[X, Y - 1] is Wall)
                {
                    Pos[X, Y]    = air;
                    Body.Visible = false;
                }
                if (Pos[X, Y - 1] is Projectile)
                {
                    Pos[X, Y]    = air;
                    Body.Visible = false;
                    Pos[X, Y - 1].Body.Visible = false;
                    Pos[X, Y - 1] = air;
                }
                if (Pos[X, Y - 1] is Player)
                {
                    Pos[X, Y]    = air;
                    Body.Visible = false;
                    Pos[X, Y - 1].Body.Visible = false;
                    Pos[X, Y - 1] = air;
                }
                break;

            case 2:
                if (Pos[X + 1, Y] is Air && X + 1 <= 32)
                {
                    Pos[X + 1, Y] = this;
                    Body.Left     = Body.Left + air.Body.Width / 32;//(int)Math.Round(0.021 * Screen.PrimaryScreen.Bounds.Width + 8)
                    X             = X + 1;
                    Pos[X - 1, Y] = air;
                }
                else
                {
                    Body.Visible = false;
                }
                if (Pos[X + 1, Y] is Wall)
                {
                    Pos[X, Y]    = air;
                    Body.Visible = false;
                }
                if (Pos[X + 1, Y] is Projectile)
                {
                    Pos[X, Y]    = air;
                    Body.Visible = false;
                    Pos[X + 1, Y].Body.Visible = false;
                    Pos[X + 1, Y] = air;
                }
                if (Pos[X + 1, Y] is Player)
                {
                    Pos[X, Y]    = air;
                    Body.Visible = false;
                    Pos[X + 1, Y].Body.Visible = false;
                    Pos[X + 1, Y] = air;
                }
                break;

            case 3:
                if (Pos[X, Y + 1] is Air && Y + 1 <= 16)
                {
                    Pos[X, Y + 1] = this;
                    Body.Top      = Body.Top + air.Body.Height / 16;//(int)Math.Round(0.082 * Screen.PrimaryScreen.Bounds.Height - 30)
                    Y             = Y + 1;
                    Pos[X, Y - 1] = air;
                }
                else
                {
                    Body.Visible = false;
                }
                if (Pos[X, Y + 1] is Wall)
                {
                    Pos[X, Y]    = air;
                    Body.Visible = false;
                }
                if (Pos[X, Y + 1] is Projectile)
                {
                    Pos[X, Y]    = air;
                    Body.Visible = false;
                    Pos[X, Y + 1].Body.Visible = false;
                    Pos[X, Y + 1] = air;
                }
                if (Pos[X, Y + 1] is Player)
                {
                    Pos[X, Y]    = air;
                    Body.Visible = false;
                    Pos[X, Y + 1].Body.Visible = false;
                    Pos[X, Y + 1] = air;
                }
                break;

            case 4:
                if (Pos[X - 1, Y] is Air && X - 1 > 0)
                {
                    Pos[X - 1, Y] = this;
                    Body.Left     = Body.Left - air.Body.Width / 32;//(int)Math.Round(0.02 * Screen.PrimaryScreen.Bounds.Width + 8)
                    X             = X - 1;
                    Pos[X + 1, Y] = air;
                }
                else
                {
                    Body.Visible = false;
                }
                if (Pos[X - 1, Y] is Wall)
                {
                    Pos[X, Y]    = air;
                    Body.Visible = false;
                }
                if (Pos[X - 1, Y] is Projectile)
                {
                    Pos[X, Y]    = air;
                    Body.Visible = false;
                    Pos[X - 1, Y].Body.Visible = false;
                    Pos[X - 1, Y] = air;
                }
                if (Pos[X - 1, Y] is Player)
                {
                    Pos[X, Y]    = air;
                    Body.Visible = false;
                    Pos[X - 1, Y].Body.Visible = false;
                    Pos[X - 1, Y] = air;
                }
                break;
            }
        }
예제 #6
0
 public void Fire(Entity[,] Pos, Air air, Timer Timer)
 {
     Console.WriteLine(X + " " + Y);
     Console.WriteLine(Pos[X, Y-1].ToString());
     if (!Projectile.Body.Visible)
     {
         switch (orientation)
         {
             case 1:
                 if (Pos[X, Y - 1] is Projectile)
                 {
                     Pos[X, Y - 1].Body.Visible = false;
                     Pos[X, Y - 1] = air;
                 }
                 if (Pos[X, Y - 1] is Air && Y - 1 > 0)
                 {
                     Projectile.Body.Visible = true;
                     Projectile.Body.Left = Body.Left + Body.Width/3;//(int)Math.Round(0.004 * Screen.PrimaryScreen.Bounds.Width + 8);
                     Projectile.Body.Top = Body.Top - (int)Math.Floor(Body.Height/1.5);//(int)Math.Round(0.045 * Screen.PrimaryScreen.Bounds.Height - 30) + (int)Math.Round(0.019 * Screen.PrimaryScreen.Bounds.Height - 30)
                     Projectile.Body.Width = 15;
                     Projectile.Body.Height = 15;
                     Projectile.X = X;
                     Projectile.Y = Y - 1;
                     Pos[Projectile.X, Projectile.Y] = Projectile;
                     Projectile.orientation = orientation;
                     Timer.Enabled = true;
                 }
                 if (Pos[X, Y - 1] is Player)
                 {
                     Pos[X, Y - 1].Body.Visible = false;
                     Pos[X, Y - 1] = air;
                 }
                 break;
             case 2:
                 if (Pos[X + 1, Y] is Projectile)
                 {
                     Pos[X + 1, Y].Body.Visible = false;
                     Pos[X + 1, Y] = air;
                 }
                 if (Pos[X + 1, Y] is Air && X + 1 <= 32)
                 {
                     Projectile.Body.Visible = true;
                     Projectile.Body.Left = Body.Left + (int)Math.Floor(Body.Width / 0.75);//(int)Math.Round(0.026 * Screen.PrimaryScreen.Bounds.Width + 8)
                     Projectile.Body.Top = Body.Top + Body.Height / 3;//(int)Math.Round(0.050 * Screen.PrimaryScreen.Bounds.Height - 30)
                     Projectile.Body.Width = 15;
                     Projectile.Body.Height = 15;
                     Projectile.X = X + 1;
                     Projectile.Y = Y;
                     Pos[Projectile.X, Projectile.Y] = Projectile;
                     Projectile.orientation = orientation;
                     Timer.Enabled = true;
                 }
                 if (Pos[X + 1, Y] is Player)
                 {
                     Pos[X + 1, Y].Body.Visible = false;
                     Pos[X + 1, Y] = air;
                 }
                 break;
             case 3:
                 if (Pos[X, Y + 1] is Projectile)
                 {
                     Pos[X, Y + 1].Body.Visible = false;
                     Pos[X, Y + 1] = air;
                 }
                 if (Pos[X, Y + 1] is Air && Y + 1 <= 16)
                 {
                     Projectile.Body.Visible = true;
                     Projectile.Body.Left = Body.Left + Body.Width / 3;//(int)Math.Round(0.004 * Screen.PrimaryScreen.Bounds.Width + 8)
                     Projectile.Body.Top = Body.Top + (int)Math.Floor(Body.Height / 0.75);//(int)Math.Round(0.090 * Screen.PrimaryScreen.Bounds.Height - 30)
                     Projectile.Body.Width = 15;
                     Projectile.Body.Height = 15;
                     Projectile.X = X;
                     Projectile.Y = Y + 1;
                     Pos[Projectile.X, Projectile.Y] = Projectile;
                     Projectile.orientation = orientation;
                     Timer.Enabled = true;
                 }
                 if (Pos[X, Y + 1] is Player)
                 {
                     Pos[X, Y + 1].Body.Visible = false;
                     Pos[X, Y + 1] = air;
                 }
                 break;
             case 4:
                 if (Pos[X - 1, Y] is Projectile)
                 {
                     Pos[X - 1, Y].Body.Visible = false;
                     Pos[X - 1, Y] = air;
                 }
                 if (Pos[X - 1, Y] is Air && X - 1 > 0)
                 {
                     Projectile.Body.Visible = true;
                     Projectile.Body.Left = Body.Left - (int)Math.Floor(Body.Width / 1.5);//(int)Math.Round(0.026 * Screen.PrimaryScreen.Bounds.Width + 8) + (int)Math.Round(0.009 * Screen.PrimaryScreen.Bounds.Width + 8)
                     Projectile.Body.Top = Body.Top + Body.Height / 3;//(int)Math.Round(0.050 * Screen.PrimaryScreen.Bounds.Height - 30)
                     Projectile.Body.Width = 15;
                     Projectile.Body.Height = 15;
                     Projectile.X = X - 1;
                     Projectile.Y = Y;
                     Pos[Projectile.X, Projectile.Y] = Projectile;
                     Projectile.orientation = orientation;
                     Timer.Enabled = true;
                 }
                 if (Pos[X - 1, Y] is Player)
                 {
                     Pos[X - 1, Y].Body.Visible = false;
                     Pos[X - 1, Y] = air;
                 }
                 break;
         }
     }
 }