示例#1
0
        public GameLogic(PictureBox enemy, PictureBox player, Label playerScore, Label enemyScore, Form1 form)
        {
            playerScoreL = playerScore;
            enemyScoreL  = enemyScore;
            parentForm   = form;

            List <PictureBox> walls = new List <PictureBox>();

            foreach (Control cont in form.Controls)
            {
                if ((cont is PictureBox) && (cont.Tag.ToString().Equals("wall")))
                {
                    walls.Add((PictureBox)cont);
                }
            }
            allCollisions = new Collisions(player, enemy, walls);

            this.player = new Player(player, allCollisions);
            this.player.dr.DrawThePlayer(player, 0);

            this.enemy = new Enemy(enemy, player, allCollisions, parentForm);
            this.player.dr.DrawTheEnemy(enemy, 0);

            tm.Interval = 20;
            tm.Tick    += new EventHandler(Tm_Tick);
            tm.Start();
        }
示例#2
0
 public Bullet(Form1 form, int xCoord, int yCoord, Collisions collisions, Vector bulletDirection)
 {
     bullet           = new PictureBox();
     parentForm       = form;
     bullet.Left      = xCoord;
     bullet.Top       = yCoord;
     bulletCollisions = collisions;
     direction        = new Vector(bulletDirection.X, bulletDirection.Y);
     tm = new Timer();
 }
示例#3
0
        public Enemy(PictureBox enemyPictureBox, PictureBox playerPictureBox, Collisions collisions, Form1 parentForm)
        {
            enemyPB         = enemyPictureBox;
            enemyCollisions = collisions;
            playerPB        = playerPictureBox;
            form            = parentForm;

            tm.Interval = 1500;
            tm.Tick    += new EventHandler(Tm_Tick);
            tm.Start();
        }
示例#4
0
 public Player(PictureBox playerPictureBox, Collisions collisions)
 {
     playerPB         = playerPictureBox;
     playerCollisions = collisions;
 }