private void gameScreen_Load(object sender, EventArgs e)
 {
     mc = new monsterClass(leftStartX, 0, playerSize, 4, monsterImages);
     monster.Add(mc);
     timer1.Enabled = true;
     timer1.Start();
     this.Focus();
 }
Exemple #2
0
        public bool collision(playerClass pc, monsterClass mc)
        {
            Rectangle pcRec = new Rectangle(pc.x, pc.y, pc.size, pc.size);
            Rectangle mcRec = new Rectangle(mc.x, mc.y, mc.size, mc.size);

            if (pcRec.IntersectsWith(mcRec))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #3
0
        public bool collision(bulletClass bc, monsterClass mc)
        {
            Rectangle bcRec = new Rectangle(bc.x, bc.y, bc.size, bc.size);
            Rectangle mcRec = new Rectangle(mc.x, mc.y, mc.size, mc.size);

            if (bcRec.IntersectsWith(mcRec))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #4
0
 public void move(monsterClass mc, string direction)
 {
     if (direction == "left")
     {
         mc.x -= mc.speed;
     }
     else if (direction == "right")
     {
         mc.x += mc.speed;
     }
     else if (direction == "up")
     {
         mc.y -= mc.speed;
     }
     else  //down
     {
         mc.y += mc.speed;
     }
 }