Exemplo n.º 1
0
 public GameMap()
 {
     map = new GameCell[Settings.fieldSize.X, Settings.fieldSize.Y];
     for (byte x = 0; x < map.GetLength(0); ++x)
     {
         for (byte y = 0; y < map.GetLength(1); ++y)
         {
             map[x, y] = new GameCell();
         }
     }
     camPos = new CoordReal(Settings.camStartPos);
 }
Exemplo n.º 2
0
 public void FireAt(double x, double y)
 {
     foreach (var hero in body)
     {
         CoordReal heroPos = new CoordReal {
             X = Canvas.GetLeft(hero.image) + hero.image.DesiredSize.Width / 2,
             Y = Canvas.GetTop(hero.image) + hero.image.DesiredSize.Height / 2,
         };
         double angle = Math.Atan2(y - heroPos.Y, x - heroPos.X) - Math.Atan2(0, 1);
         angle = (angle * 180.0 / 3.14159);
         hero.Shoot(angle, heroPos);
     }
 }
Exemplo n.º 3
0
        public Bullet(string path, double angle, CoordReal shootPos, byte speed)
        {
            pos        = new CoordReal(shootPos);
            this.speed = speed;
            this.angle = angle;

            image = new Image();
            image.LoadImg(path);
            image.RenderTransformOrigin = new Point(0.5, 0.5);
            image.RenderTransform       = new RotateTransform(angle);
            Settings.gameWindow.GameCanvas.Children.Add(image);
            Canvas.SetZIndex(image, 10);
            Canvas.SetLeft(image, pos.X);
            Canvas.SetTop(image, pos.Y);

            Settings.game.bullets.Add(this);
        }
Exemplo n.º 4
0
 public override Bullet Shoot(double angle, CoordReal shootPos)
 {
     return(new Bullet("hero\\ghostBullet", angle, shootPos, 5));
 }
Exemplo n.º 5
0
Arquivo: Hero.cs Projeto: Team-on/LD42
 abstract public Bullet Shoot(double angle, CoordReal shootPos);