Ejemplo n.º 1
0
 public void EnemyCollision(NonPlayer npo)
 {
     if (PointInShape(npo))
     {
         npo.wtd();
         Location = respawn;
     }
 }
Ejemplo n.º 2
0
 private void SubPointsM()
 {
     db.Score      -= 200;
     scoreP.Text    = db.Score.ToString();
     mush1.Location = new Point(2000, 10000);
     mush1          = null;
     this.Controls.Remove(mush1);
 }
Ejemplo n.º 3
0
 public bool PointInShape(NonPlayer npo)
 {
     if (this.Bottom > npo.Top && this.Top < npo.Bottom)
     {
         if (this.Right > npo.Left && this.Left < npo.Right)
         {
             return(true);
         }
         return(false);
     }
     return(false);
 }
Ejemplo n.º 4
0
 private void MoveNPO(NonPlayer npo)
 {
     if (npo.Direct == (Direction.Left | Direction.Cycling))
     {
         if (npo.Left > npo.StartX - npo.Steps)
         {
             npo.Left -= velocity;
         }
         else
         {
             npo.Direct = (Direction.Right | Direction.Cycling);
             npo.StartX = npo.Left;
         }
     }
     else if (npo.Direct == (Direction.Right | Direction.Cycling))
     {
         if (npo.Left < npo.StartX + npo.Steps)
         {
             npo.Left += velocity;
         }
         else
         {
             npo.Direct = (Direction.Cycling | Direction.Left);
             npo.StartX = npo.Left;
         }
     }
     else if (npo.Direct == (Direction.Up | Direction.Cycling))
     {
         if (npo.Top > npo.StartY - npo.Steps)
         {
             npo.Top -= velocity;
         }
         else
         {
             npo.Direct = (Direction.Down | Direction.Cycling);
             npo.StartY = npo.Top;
         }
     }
     else if (npo.Direct == (Direction.Down | Direction.Cycling))
     {
         if (npo.Top < npo.StartY + npo.Steps)
         {
             npo.Top += velocity;
         }
         else
         {
             npo.Direct = (Direction.Up | Direction.Cycling);
             npo.StartY = npo.Top;
         }
     }
 }
Ejemplo n.º 5
0
 private void MoveNPO(NonPlayer currentNPO)
 {
     if (currentNPO.Direct == (Direction.Left | Direction.Cycling)) //moving left
     {
         if (currentNPO.Left > currentNPO.StartX - currentNPO.Steps)
         {
             currentNPO.Left -= velocity;
         }
         else
         {
             currentNPO.Direct = (Direction.Right | Direction.Cycling);
             currentNPO.StartX = currentNPO.Left;
         }
     }
     else if (currentNPO.Direct == (Direction.Right | Direction.Cycling))//moving right
     {
         if (currentNPO.Left < currentNPO.StartX + currentNPO.Steps)
         {
             currentNPO.Left += velocity;
         }
         else
         {
             currentNPO.Direct = (Direction.Cycling | Direction.Left);
             currentNPO.StartX = currentNPO.Left;
         }
     }
     else if (currentNPO.Direct == (Direction.Up | Direction.Cycling))//moving up
     {
         if (currentNPO.Top > currentNPO.StartY - currentNPO.Steps)
         {
             currentNPO.Top -= velocity;
         }
         else
         {
             currentNPO.Direct = (Direction.Down | Direction.Cycling);
             currentNPO.StartY = currentNPO.Top;
         }
     }
     else if (currentNPO.Direct == (Direction.Down | Direction.Cycling))//moving down
     {
         if (currentNPO.Top < currentNPO.StartY + currentNPO.Steps)
         {
             currentNPO.Top += velocity;
         }
         else
         {
             currentNPO.Direct = (Direction.Up | Direction.Cycling);
             currentNPO.StartY = currentNPO.Top;
         }
     }
 }
Ejemplo n.º 6
0
        private void InitializeMyComponent()
        {
            player = new Player(respawn, 4);

            ////*grounds*/////
            npo[0]  = new NonPlayer(false, false, 0, Direction.None);
            npo[1]  = new NonPlayer(false, false, 0, Direction.None);
            npo[2]  = new NonPlayer(false, false, 0, Direction.None);
            npo[3]  = new NonPlayer(false, false, 0, Direction.None);
            npo[4]  = new NonPlayer(false, false, 0, Direction.None);
            npo[5]  = new NonPlayer(false, false, 0, Direction.None);
            npo[6]  = new NonPlayer(false, false, 0, Direction.None);
            npo[7]  = new NonPlayer(false, false, 0, Direction.None);
            npo[8]  = new NonPlayer(false, false, 0, Direction.None);
            npo[9]  = new NonPlayer(false, false, 0, Direction.None);
            npo[10] = new NonPlayer(false, false, 0, Direction.None);
            npo[11] = new NonPlayer(false, false, 0, Direction.None);
            npo[12] = new NonPlayer(false, false, 0, Direction.None);
            npo[13] = new NonPlayer(false, false, 0, Direction.None);
            npo[14] = new NonPlayer(false, false, 0, Direction.None);
            npo[15] = new NonPlayer(false, false, 0, Direction.None);
            npo[16] = new NonPlayer(false, false, 0, Direction.None);
            npo[17] = new NonPlayer(false, false, 0, Direction.None);
            npo[18] = new NonPlayer(false, false, 0, Direction.None);

            ////////////////////////////////////////////////////

            //*ladder*///
            ladder1 = new NonPlayer(false, true, 0, Direction.None);
            ladder2 = new NonPlayer(false, true, 0, Direction.None);
            ladder3 = new NonPlayer(false, true, 0, Direction.None);
            ////////////

            ////mushroom///////
            mush1 = new NonPlayer(false, true, 0, Direction.None, () => SubPointsM());

            npo[22] = new NonPlayer(false, true, 0, Direction.None, () => AddPointsC(22));
            npo[23] = new NonPlayer(false, true, 0, Direction.None, () => AddPointsC(23));
            npo[24] = new NonPlayer(false, true, 0, Direction.None, () => AddPointsC(24));
            npo[25] = new NonPlayer(false, true, 0, Direction.None, () => AddPointsC(25));
            npo[26] = new NonPlayer(false, true, 0, Direction.None, () => AddPointsC(26));
            npo[27] = new NonPlayer(false, true, 0, Direction.None, () => AddPointsC(27));
            npo[28] = new NonPlayer(false, true, 0, Direction.None, () => AddPointsC(28));
            npo[29] = new NonPlayer(false, true, 0, Direction.None, () => AddPointsC(29));
            npo[30] = new NonPlayer(false, true, 0, Direction.None, () => AddPointsC(30));

            //**diamond**//
            npo[31] = new NonPlayer(false, true, 0, Direction.None, () => AddPointsD(31));

            //*falling*///
            npo[32] = new NonPlayer(false, false, 40, Direction.Down | Direction.Cycling);
            npo[33] = new NonPlayer(false, false, 35, Direction.Down | Direction.Cycling);
            npo[34] = new NonPlayer(false, false, 45, Direction.Up | Direction.Cycling);
            npo[35] = new NonPlayer(false, false, 50, Direction.Down | Direction.Cycling);
            npo[36] = new NonPlayer(false, false, 50, Direction.Up | Direction.Cycling);
            npo[37] = new NonPlayer(false, false, 40, Direction.Down | Direction.Cycling);

            //*spikes*//
            npo[38] = new NonPlayer(true, false, 0, Direction.None, SubLife); //1
            npo[39] = new NonPlayer(true, false, 0, Direction.None, SubLife); //10-39
            npo[40] = new NonPlayer(true, false, 0, Direction.None, SubLife); //11-40
            npo[41] = new NonPlayer(true, false, 0, Direction.None, SubLife); //12-41
            npo[42] = new NonPlayer(true, false, 0, Direction.None, SubLife); //13-42

            //*ninja-star*///
            npo[43] = new NonPlayer(true, false, 25, Direction.Up | Direction.Cycling, SubLife); //1-43
            npo[44] = new NonPlayer(true, false, 0, Direction.None, SubLife);                    //2-44
            npo[45] = new NonPlayer(true, false, 80, Direction.Up | Direction.Cycling, SubLife); //3-45

            //**movPlat**//
            npo[46] = new NonPlayer(false, false, 100, (Direction.Left | Direction.Cycling)); //1-46
            npo[47] = new NonPlayer(false, false, 70, (Direction.Left | Direction.Cycling));  //2-47

            //**pipes**//
            npo[48] = new NonPlayer(false, false, 0, Direction.None); //1-48
            npo[49] = new NonPlayer(false, false, 0, Direction.None); //2-49

            ////      //*moviPlat3**//
            npo[50] = new NonPlayer(false, false, 140, (Direction.Up | Direction.Cycling));//3-54

            //**door**//
            npo[51] = new NonPlayer(false, true, 0, Direction.None, NextLevel);//52
            //
            //
            //properties//
            //
            npo[33].Image    = global::TheSurvivor.Properties.Resources.fallingNew;
            npo[33].Location = new System.Drawing.Point(616, 629);
            npo[33].Name     = "death2";
            npo[33].Size     = new System.Drawing.Size(88, 36);
            npo[33].StartX   = npo[33].Left; npo[33].StartY = npo[33].Top;
            //
            // ground2
            //
            npo[1].Location = new System.Drawing.Point(939, 564);
            npo[1].Name     = "ground2";
            npo[1].Size     = new System.Drawing.Size(88, 36);
            npo[1].Visible  = false;
            //
            // ground3
            //
            npo[2].Location = new System.Drawing.Point(753, 452);
            npo[2].Name     = "ground3";
            npo[2].Size     = new System.Drawing.Size(200, 53);
            npo[2].Visible  = false;
            //
            // spikes1
            //
            npo[38].Location = new System.Drawing.Point(476, 734);
            npo[38].Name     = "spikes1";
            npo[38].Size     = new System.Drawing.Size(548, 38);
            npo[38].Visible  = false;
            //********//
            /*ladder1*/
            //******//
            ladder1.Location = new System.Drawing.Point(990, 460);
            ladder1.Name     = "ladder1";
            ladder1.Size     = new System.Drawing.Size(30, 101);
            ladder1.Visible  = false;
            //
            // movPlat1
            //
            npo[46].Image    = global::TheSurvivor.Properties.Resources.movPlat11;
            npo[46].Location = new System.Drawing.Point(450, 417);
            npo[46].Name     = "movPlat1";
            npo[46].Size     = new System.Drawing.Size(120, 20);
            npo[46].StartX   = npo[46].Left;
            npo[46].StartY   = npo[46].Top;
            //
            // pipe1
            //
            npo[48].Location = new System.Drawing.Point(154, 349);
            npo[48].Name     = "pipe1";
            npo[48].Size     = new System.Drawing.Size(59, 61);
            npo[48].Visible  = false;
            //
            // ground5-pipe2
            //
            npo[4].Location = new System.Drawing.Point(0, 310);
            npo[4].Name     = "ground5";
            npo[4].Size     = new System.Drawing.Size(90, 47);
            npo[4].Visible  = false;
            //
            // pipe2
            //
            npo[49].Location = new System.Drawing.Point(1, 270);
            npo[49].Name     = "pipe2";
            npo[49].Size     = new System.Drawing.Size(57, 30);
            npo[49].Visible  = false;
            //
            // death1
            //
            npo[32].Image    = global::TheSurvivor.Properties.Resources.miniFalling2;
            npo[32].Location = new System.Drawing.Point(503, 660);
            npo[32].Name     = "death1";
            npo[32].Size     = new System.Drawing.Size(60, 30);
            npo[32].StartX   = npo[32].Left; npo[32].StartY = npo[32].Top;
            //
            // death3
            //
            npo[34].Image    = global::TheSurvivor.Properties.Resources.fallingNew;
            npo[34].Location = new System.Drawing.Point(729, 655);
            npo[34].Name     = "death3";
            npo[34].Size     = new System.Drawing.Size(88, 36);
            npo[34].StartX   = npo[34].Left;
            npo[34].StartY   = npo[34].Top;
            //
            // death4
            //
            npo[35].Image    = global::TheSurvivor.Properties.Resources.fallingNew;
            npo[35].Location = new System.Drawing.Point(829, 560);
            npo[35].StartX   = npo[35].Left; npo[35].StartY = npo[35].Top;
            npo[35].Name     = "death4";
            npo[35].Size     = new System.Drawing.Size(88, 36);
            //
            // ground4-after ninja1
            //
            npo[3].Location = new System.Drawing.Point(616, 445);
            npo[3].Name     = "ground4";
            npo[3].Size     = new System.Drawing.Size(66, 31);
            npo[3].Visible  = false;
            //
            // spikes10-right of ninja1
            //
            npo[39].Location = new System.Drawing.Point(386, 454);
            npo[39].Name     = "spikes10";
            npo[39].Size     = new System.Drawing.Size(60, 41);
            npo[39].Visible  = false;
            //
            // fire1
            //
            npo[43].BackColor = System.Drawing.Color.Transparent;
            npo[43].Image     = global::TheSurvivor.Properties.Resources.fire3;
            npo[43].Location  = new System.Drawing.Point(700, 457);
            npo[43].Name      = "ninjaStar1";
            npo[43].Size      = new System.Drawing.Size(36, 35);
            npo[43].TabIndex  = 38;
            npo[43].StartX    = npo[43].Left; npo[43].StartY = npo[43].Top;
            npo[43].TabStop   = false;
            //
            // coin1
            //
            npo[22].BackColor = System.Drawing.Color.Transparent;
            npo[22].Image     = global::TheSurvivor.Properties.Resources.Mycoin2;
            npo[22].SendToBack();
            npo[22].Location = new System.Drawing.Point(532, 620);
            npo[22].Name     = "coin1";
            npo[22].Size     = new System.Drawing.Size(25, 29);
            //
            // coin2
            //
            npo[23].BackColor = System.Drawing.Color.Transparent;
            npo[23].Image     = global::TheSurvivor.Properties.Resources.Mycoin;
            npo[23].SendToBack();
            npo[23].Location = new System.Drawing.Point(532, 585);
            npo[23].Name     = "coin2";
            npo[23].Size     = new System.Drawing.Size(25, 29);
            npo[23].TabIndex = 44;
            npo[23].TabStop  = false;
            //
            // coin3
            //
            npo[24].BackColor = System.Drawing.Color.Transparent;
            npo[24].Image     = global::TheSurvivor.Properties.Resources.Mycoin2;
            npo[24].SendToBack();
            npo[24].Location = new System.Drawing.Point(532, 550);
            npo[24].Name     = "coin3";
            npo[24].Size     = new System.Drawing.Size(25, 29);
            npo[24].TabIndex = 45;
            npo[24].TabStop  = false;
            //
            // coin4
            //
            npo[25].BackColor = System.Drawing.Color.Transparent;
            npo[25].Image     = global::TheSurvivor.Properties.Resources.Mycoin2;
            npo[25].SendToBack();
            npo[25].Location = new System.Drawing.Point(949, 532);
            npo[25].Name     = "coin4";
            npo[25].Size     = new System.Drawing.Size(25, 29);
            npo[25].TabIndex = 46;
            npo[25].TabStop  = false;
            //
            // coin5
            //
            npo[26].BackColor = System.Drawing.Color.Transparent;
            npo[26].Image     = global::TheSurvivor.Properties.Resources.Mycoin;
            npo[26].SendToBack();
            npo[26].Location = new System.Drawing.Point(254, 370);
            npo[26].Name     = "coin5";
            npo[26].Size     = new System.Drawing.Size(25, 29);
            npo[26].TabIndex = 47;
            npo[26].TabStop  = false;
            //
            // fire2
            //
            npo[44].BackColor = System.Drawing.Color.Transparent;
            npo[44].Image     = global::TheSurvivor.Properties.Resources.fire3;
            npo[44].Location  = new System.Drawing.Point(334, 465);
            npo[44].Name      = "ninjaStar2";
            npo[44].Size      = new System.Drawing.Size(36, 35);
            npo[44].TabIndex  = 48;
            npo[44].TabStop   = false;
            //
            // movPlat2
            //
            npo[47].Image    = global::TheSurvivor.Properties.Resources.movPlat21;
            npo[47].Location = new System.Drawing.Point(100, 220);
            npo[47].Name     = "movPlat2";
            npo[47].Size     = new System.Drawing.Size(100, 20);
            npo[47].TabIndex = 49;
            npo[47].StartX   = npo[47].Left; npo[47].StartY = npo[47].Top;
            npo[47].TabStop  = false;
            //
            // death5
            //
            npo[36].Image    = global::TheSurvivor.Properties.Resources.fallingNew;
            npo[36].Location = new System.Drawing.Point(272, 230);
            npo[36].Name     = "death5";
            npo[36].Size     = new System.Drawing.Size(88, 36);
            npo[36].TabIndex = 50;
            npo[36].StartX   = npo[36].Left; npo[36].StartY = npo[36].Top;
            npo[36].TabStop  = false;
            //
            // death6
            //
            npo[37].Image    = global::TheSurvivor.Properties.Resources.fallingNew;
            npo[37].Location = new System.Drawing.Point(386, 244);
            npo[37].Name     = "death6";
            npo[37].Size     = new System.Drawing.Size(88, 36);
            npo[37].TabIndex = 51;
            npo[37].StartX   = npo[37].Left; npo[37].StartY = npo[37].Top;
            npo[37].TabStop  = false;
            //
            // spikes11-between pipes
            //
            npo[40].Location = new System.Drawing.Point(88, 328);
            npo[40].Name     = "spikes11";
            npo[40].Size     = new System.Drawing.Size(59, 38);
            npo[40].TabIndex = 52;
            npo[40].TabStop  = false;
            npo[40].Visible  = false;
            //
            // ground6-up ladder2
            //
            npo[5].Location = new System.Drawing.Point(496, 235);
            npo[5].Name     = "ground6";
            npo[5].Size     = new System.Drawing.Size(84, 31);
            npo[5].Visible  = false;
            //
            // ladder2
            //
            ladder2.Location = new System.Drawing.Point(588, 243);
            ladder2.Name     = "ladder2";
            ladder2.Size     = new System.Drawing.Size(30, 76);
            ladder2.Visible  = false;
            //
            // ground7-laddder2
            //
            npo[6].Location = new System.Drawing.Point(580, 320);
            npo[6].Name     = "ground7";
            npo[6].Size     = new System.Drawing.Size(162, 29);
            npo[6].Visible  = false;
            //
            // coin6
            //
            npo[27].BackColor = System.Drawing.Color.Transparent;
            npo[27].Image     = global::TheSurvivor.Properties.Resources.Mycoin2;
            npo[27].SendToBack();
            npo[27].Name     = "coin6";
            npo[27].Size     = new System.Drawing.Size(25, 29);
            npo[27].TabIndex = 56;
            npo[27].Location = new System.Drawing.Point(412, 335);
            npo[27].TabStop  = false;
            //
            // coin7
            //
            npo[28].BackColor = System.Drawing.Color.Transparent;
            npo[28].Image     = global::TheSurvivor.Properties.Resources.Mycoin;
            npo[28].SendToBack();
            npo[28].Location = new System.Drawing.Point(412, 192);
            npo[28].Name     = "coin7";
            npo[28].Size     = new System.Drawing.Size(25, 29);
            npo[28].TabIndex = 57;
            npo[28].TabStop  = false;
            //
            // movPlat3- left Up plat
            //
            npo[50].Image    = global::TheSurvivor.Properties.Resources.movPlat31;
            npo[50].Location = new System.Drawing.Point(743, 390);
            npo[50].Name     = "movPlat3";
            npo[50].Size     = new System.Drawing.Size(40, 20);
            npo[50].TabIndex = 58;
            npo[50].TabStop  = false;
            npo[50].StartX   = npo[50].Left; npo[50].StartY = npo[50].Top;
            //
            // ground8-greenFloor before tree
            //
            npo[7].Location = new System.Drawing.Point(813, 278);
            npo[7].Name     = "ground8";
            npo[7].Size     = new System.Drawing.Size(53, 30);
            npo[7].TabIndex = 59;
            npo[7].TabStop  = false;
            npo[7].Visible  = false;
            //
            // ground9-tree
            //
            npo[8].BackColor = System.Drawing.Color.Transparent;
            npo[8].Location  = new System.Drawing.Point(880, 235);
            npo[8].Name      = "ground9";
            npo[8].Size      = new System.Drawing.Size(147, 30);
            npo[8].TabIndex  = 60;
            npo[8].TabStop   = false;
            npo[8].Visible   = false;
            //
            // coin8
            //
            npo[29].BackColor = System.Drawing.Color.Transparent;
            npo[29].Image     = global::TheSurvivor.Properties.Resources.Mycoin2;
            npo[29].SendToBack();
            npo[29].Location = new System.Drawing.Point(752, 208);
            npo[29].Name     = "coin8";
            npo[29].Size     = new System.Drawing.Size(25, 29);
            npo[29].TabIndex = 62;
            npo[29].TabStop  = false;
            //
            // ground11-down ladder3
            //
            npo[10].Location = new System.Drawing.Point(826, 168);
            npo[10].Name     = "ground11";
            npo[10].Size     = new System.Drawing.Size(63, 20);
            npo[10].TabIndex = 64;
            npo[10].TabStop  = false;
            npo[10].Visible  = false;
            //
            // ground12-down ground11
            //
            npo[11].Location = new System.Drawing.Point(889, 178);
            npo[11].Name     = "ground12";
            npo[11].Size     = new System.Drawing.Size(20, 10);
            npo[11].Visible  = false;
            //
            // ground13-left of ninja3
            //
            npo[12].Location = new System.Drawing.Point(437, 122);
            npo[12].Name     = "ground13";
            npo[12].Size     = new System.Drawing.Size(65, 14);
            npo[12].Visible  = false;
            //
            // ground14
            //
            npo[13].Location = new System.Drawing.Point(346, 106);
            npo[13].Name     = "ground14";
            npo[13].Size     = new System.Drawing.Size(67, 11);
            npo[13].Visible  = false;
            //
            // ground15
            //
            npo[14].Location = new System.Drawing.Point(246, 84);
            npo[14].Name     = "ground15";
            npo[14].Size     = new System.Drawing.Size(67, 11);
            npo[14].Visible  = false;
            //
            // ground16- before diamond
            //
            npo[15].Location = new System.Drawing.Point(149, 68);
            npo[15].Name     = "ground16";
            npo[15].Size     = new System.Drawing.Size(69, 11);
            npo[15].Visible  = false;
            //
            // coin9
            //
            npo[30].BackColor = System.Drawing.Color.Transparent;
            npo[30].Image     = global::TheSurvivor.Properties.Resources.Mycoin;
            npo[30].SendToBack();
            npo[30].Location = new System.Drawing.Point(364, 77);
            npo[30].Name     = "coin9";
            npo[30].Size     = new System.Drawing.Size(25, 29);
            npo[30].TabIndex = 70;
            npo[30].TabStop  = false;
            //
            //apple-diamond
            //
            npo[31].BackColor = System.Drawing.Color.Transparent;
            npo[31].Image     = global::TheSurvivor.Properties.Resources.apple;
            npo[31].SendToBack();
            npo[31].Location = new System.Drawing.Point(87, 93);
            npo[31].Name     = "diamond";
            npo[31].Size     = new System.Drawing.Size(25, 29);
            npo[31].TabIndex = 71;
            npo[31].TabStop  = false;
            //
            // ground17-diamond
            //
            npo[16].Location = new System.Drawing.Point(25, 142);
            npo[16].Name     = "ground17";
            npo[16].Size     = new System.Drawing.Size(69, 11);
            npo[16].TabIndex = 72;
            npo[16].TabStop  = false;
            npo[16].Visible  = false;
            //
            // spikes12 right upper
            //
            npo[41].Location = new System.Drawing.Point(728, 125);
            npo[41].Name     = "spikes12";
            npo[41].Size     = new System.Drawing.Size(48, 25);
            npo[41].TabIndex = 74;
            npo[41].TabStop  = false;
            npo[41].Visible  = false;
            //
            // fire3
            //
            npo[45].BackColor = System.Drawing.Color.Transparent;
            npo[45].Image     = global::TheSurvivor.Properties.Resources.fire3;
            npo[45].Location  = new System.Drawing.Point(503, 117);
            npo[45].Name      = "ninjaStar3";
            npo[45].Size      = new System.Drawing.Size(36, 35);
            npo[45].StartX    = npo[45].Left; npo[45].StartY = npo[45].Bottom;
            npo[45].TabIndex  = 75;
            npo[45].TabStop   = false;
            //
            // spikes13-left upper
            //
            npo[42].Location = new System.Drawing.Point(595, 124);
            npo[42].Name     = "spikes13";
            npo[42].Size     = new System.Drawing.Size(48, 25);
            npo[42].Visible  = false;
            //
            // ground10- two spikes up
            //
            npo[9].Location = new System.Drawing.Point(538, 141);
            npo[9].Name     = "ground10";
            npo[9].Size     = new System.Drawing.Size(292, 38);
            npo[9].Visible  = false;
            //
            // ladder3
            //
            ladder3.Location = new System.Drawing.Point(852, 103);
            ladder3.Name     = "ladder3";
            ladder3.Size     = new System.Drawing.Size(31, 64);
            ladder3.Visible  = false;
            //
            // ground18-door
            //
            npo[17].Location = new System.Drawing.Point(888, 100);
            npo[17].Name     = "ground18";
            npo[17].Size     = new System.Drawing.Size(124, 17);
            npo[17].Visible  = false;
            //
            // doorOut
            //
            npo[51].Location = new System.Drawing.Point(945, 35);
            npo[51].Name     = "doorOut";
            npo[51].Size     = new System.Drawing.Size(30, 60);
            npo[51].Visible  = false;

            //
            // ground19-pipe1
            //
            npo[18].Location = new System.Drawing.Point(154, 410);
            npo[18].Name     = "ground19";
            npo[18].Size     = new System.Drawing.Size(159, 47);
            npo[18].Visible  = false;
            //
            // ground1
            //
            npo[0].Name     = "ground1";
            npo[0].Size     = new System.Drawing.Size(477, 130);
            npo[0].Location = new System.Drawing.Point(0, 650);
            npo[0].Visible  = false;
            //
            //mush1
            //
            mush1.BackColor = System.Drawing.Color.Transparent;
            mush1.Image     = global::TheSurvivor.Properties.Resources.mushroom1;
            mush1.Location  = new System.Drawing.Point(1065, 140);
            mush1.Name      = "mush1";
            mush1.Size      = new System.Drawing.Size(25, 29);
            mush1.Visible   = false;
            //
            //lables + proccessBar
            //
            hpl.BackColor      = System.Drawing.Color.Transparent;
            Scorelab.BackColor = System.Drawing.Color.Transparent;
            scoreP.BackColor   = System.Drawing.Color.Transparent;
            //
            // playerBox
            //
            player.Image     = global::TheSurvivor.Properties.Resources.IdleNonGif;
            player.SizeMode  = PictureBoxSizeMode.StretchImage;
            player.BackColor = Color.Transparent;
            player.Location  = new System.Drawing.Point(108, 605);
            player.Name      = "playerBox";
            player.Size      = new System.Drawing.Size(35, 45);
            player.TabIndex  = 12;
            player.TabStop   = false;
            player.BringToFront();
            for (int i = 0; i < 51; i++)
            {
                this.Controls.Add(npo[i]);
            }
            this.Controls.Add(player);
            this.Controls.Add(mush1);
            this.Controls.Add(hpl);
            this.Controls.Add(pb1);
            this.Controls.Add(Scorelab);
            this.Controls.Add(scoreP);
        }
Ejemplo n.º 7
0
        private void InitializeMyComponenets()
        {
            //player
            player = new Player(respawn, 5);
            //floors
            npo[0]  = new NonPlayer(false, false, 0, Direction.None);
            npo[1]  = new NonPlayer(false, false, 0, Direction.None);
            npo[2]  = new NonPlayer(false, false, 0, Direction.None);
            npo[3]  = new NonPlayer(false, false, 0, Direction.None);
            npo[4]  = new NonPlayer(false, false, 0, Direction.None);
            npo[5]  = new NonPlayer(false, false, 0, Direction.None);
            npo[6]  = new NonPlayer(false, false, 0, Direction.None);
            npo[7]  = new NonPlayer(false, false, 0, Direction.None);
            npo[8]  = new NonPlayer(false, false, 0, Direction.None);
            npo[9]  = new NonPlayer(false, false, 0, Direction.None);
            npo[10] = new NonPlayer(false, false, 0, Direction.None);
            npo[11] = new NonPlayer(false, false, 0, Direction.None);
            npo[12] = new NonPlayer(false, false, 0, Direction.None);
            npo[13] = new NonPlayer(false, false, 0, Direction.None);
            npo[14] = new NonPlayer(false, false, 0, Direction.None);
            npo[15] = new NonPlayer(false, false, 0, Direction.None);
            npo[16] = new NonPlayer(false, false, 0, Direction.None);
            npo[17] = new NonPlayer(false, false, 0, Direction.None);
            npo[18] = new NonPlayer(false, false, 0, Direction.None);
            //enemies
            npo[19] = new NonPlayer(true, false, 0, Direction.None, LoseHP);
            npo[20] = new NonPlayer(true, false, 0, Direction.None, LoseHP);
            npo[21] = new NonPlayer(true, false, 0, Direction.None, LoseHP);
            npo[22] = new NonPlayer(true, false, 0, Direction.None, LoseHP);
            npo[23] = new NonPlayer(true, false, 0, Direction.None, LoseHP);
            npo[24] = new NonPlayer(true, false, 0, Direction.None, LoseHP);
            npo[25] = new NonPlayer(true, false, 0, Direction.None, LoseHP);
            npo[26] = new NonPlayer(true, false, 0, Direction.None, LoseHP);
            npo[27] = new NonPlayer(true, false, 0, Direction.None, LoseHP);
            npo[28] = new NonPlayer(true, false, 0, Direction.None, LoseHP);
            npo[29] = new NonPlayer(true, false, 0, Direction.None, LoseHP);
            //diamonds
            npo[30] = new NonPlayer(false, true, 0, Direction.None, () => AddPointsSpecial(30)); //red
            npo[31] = new NonPlayer(false, true, 0, Direction.None, () => AddPointsBlue(31));
            npo[32] = new NonPlayer(false, true, 0, Direction.None, () => AddPointsRed(32));     //red
            npo[33] = new NonPlayer(false, true, 0, Direction.None, () => AddPointsBlue(33));
            npo[34] = new NonPlayer(false, true, 0, Direction.None, () => AddPointsBlue(34));
            npo[35] = new NonPlayer(false, true, 0, Direction.None, () => AddPointsBlue(35));
            npo[36] = new NonPlayer(false, true, 0, Direction.None, () => AddPointsRed(36));//red
            //moving floors
            npo[37] = new NonPlayer(false, false, 140, (Direction.Right | Direction.Cycling));
            npo[38] = new NonPlayer(false, false, 170, (Direction.Down | Direction.Cycling));
            npo[39] = new NonPlayer(false, false, 370, (Direction.Left | Direction.Cycling));
            //moving enemy
            npo[40] = new NonPlayer(true, false, 100, (Direction.Down | Direction.Cycling), LoseHP);
            npo[41] = new NonPlayer(true, false, 80, (Direction.Up | Direction.Cycling), LoseHP);
            npo[42] = new NonPlayer(true, false, 80, (Direction.Down | Direction.Cycling), LoseHP);
            //portal
            npo[43] = new NonPlayer(false, true, 0, Direction.None, NextLevel);
            //ladders
            ladder1 = new NonPlayer(false, true, 0, Direction.None);
            ladder2 = new NonPlayer(false, true, 0, Direction.None);
            ladder3 = new NonPlayer(false, true, 0, Direction.None);
            ladder4 = new NonPlayer(false, true, 0, Direction.None);
            //
            // floor1
            //
            npo[0].BackColor = System.Drawing.Color.Transparent;
            npo[0].Location  = new System.Drawing.Point(-1, 741);
            npo[0].Name      = "floor1";
            npo[0].Size      = new System.Drawing.Size(154, 27);
            //
            // floor2
            //
            npo[1].BackColor = System.Drawing.Color.Transparent;
            npo[1].Location  = new System.Drawing.Point(227, 742);
            npo[1].Name      = "floor2";
            npo[1].Size      = new System.Drawing.Size(161, 26);
            //
            // floor3
            //
            npo[2].BackColor = System.Drawing.Color.Transparent;
            npo[2].Location  = new System.Drawing.Point(607, 741);
            npo[2].Name      = "floor3";
            npo[2].Size      = new System.Drawing.Size(159, 27);
            //
            // floor4
            //
            npo[3].BackColor = System.Drawing.Color.Transparent;
            npo[3].Location  = new System.Drawing.Point(804, 683);
            npo[3].Name      = "floor4";
            npo[3].Size      = new System.Drawing.Size(36, 30);
            //
            // floor5
            //
            npo[4].BackColor = System.Drawing.Color.Transparent;
            npo[4].Location  = new System.Drawing.Point(915, 742);
            npo[4].Name      = "floor5";
            npo[4].Size      = new System.Drawing.Size(109, 26);
            //
            // floor6
            //
            npo[5].BackColor = System.Drawing.Color.Transparent;
            npo[5].Location  = new System.Drawing.Point(844, 523);
            npo[5].Name      = "floor6";
            npo[5].Size      = new System.Drawing.Size(136, 36);
            //
            // floor7
            //
            npo[6].BackColor = System.Drawing.Color.Transparent;
            npo[6].Location  = new System.Drawing.Point(881, 403);
            npo[6].Name      = "floor7";
            npo[6].Size      = new System.Drawing.Size(143, 26);
            //
            // floor8
            //
            npo[7].BackColor = System.Drawing.Color.Transparent;
            npo[7].Location  = new System.Drawing.Point(852, 320);
            npo[7].Name      = "floor8";
            npo[7].Size      = new System.Drawing.Size(59, 29);
            //
            // floor9
            //
            npo[8].BackColor = System.Drawing.Color.Transparent;
            npo[8].Location  = new System.Drawing.Point(552, 495);
            npo[8].Name      = "floor9";
            npo[8].Size      = new System.Drawing.Size(74, 30);
            //
            // floor10
            //
            npo[9].BackColor = System.Drawing.Color.Transparent;
            npo[9].Location  = new System.Drawing.Point(345, 495);
            npo[9].Name      = "floor10";
            npo[9].Size      = new System.Drawing.Size(132, 29);
            //
            // floor11
            //
            npo[10].BackColor = System.Drawing.Color.Transparent;
            npo[10].Location  = new System.Drawing.Point(50, 494);
            npo[10].Name      = "floor11";
            npo[10].Size      = new System.Drawing.Size(238, 28);
            //
            // floor12
            //
            npo[11].BackColor = System.Drawing.Color.Transparent;
            npo[11].Location  = new System.Drawing.Point(82, 334);
            npo[11].Name      = "floor12";
            npo[11].Size      = new System.Drawing.Size(193, 28);
            //
            // floor13
            //
            npo[12].BackColor = System.Drawing.Color.Transparent;
            npo[12].Location  = new System.Drawing.Point(354, 333);
            npo[12].Name      = "floor13";
            npo[12].Size      = new System.Drawing.Size(217, 30);
            //
            // floor14
            //
            npo[13].BackColor = System.Drawing.Color.Transparent;
            npo[13].Location  = new System.Drawing.Point(-1, 154);
            npo[13].Name      = "floor14";
            npo[13].Size      = new System.Drawing.Size(63, 29);
            //
            // floor15
            //
            npo[14].BackColor = System.Drawing.Color.Transparent;
            npo[14].Location  = new System.Drawing.Point(100, 85);
            npo[14].Name      = "floor15";
            npo[14].Size      = new System.Drawing.Size(64, 28);
            //
            // floor16
            //
            npo[15].BackColor = System.Drawing.Color.Transparent;
            npo[15].Location  = new System.Drawing.Point(218, 71);
            npo[15].Name      = "floor16";
            npo[15].Size      = new System.Drawing.Size(148, 31);
            //
            // floor17
            //
            npo[16].BackColor = System.Drawing.Color.Transparent;
            npo[16].Location  = new System.Drawing.Point(451, 71);
            npo[16].Name      = "floor17";
            npo[16].Size      = new System.Drawing.Size(84, 31);
            //
            // floor18
            //
            npo[17].BackColor = System.Drawing.Color.Transparent;
            npo[17].Location  = new System.Drawing.Point(566, 127);
            npo[17].Name      = "floor18";
            npo[17].Size      = new System.Drawing.Size(139, 28);
            //
            // floor19
            //
            npo[18].BackColor = System.Drawing.Color.Transparent;
            npo[18].Location  = new System.Drawing.Point(784, 151);
            npo[18].Name      = "floor19";
            npo[18].Size      = new System.Drawing.Size(243, 35);
            //
            // enemy1
            //
            npo[19].BackColor = System.Drawing.Color.Transparent;
            npo[19].Location  = new System.Drawing.Point(166, 704);
            npo[19].Name      = "enemy1";
            npo[19].Size      = new System.Drawing.Size(54, 64);
            //
            // enemy2
            //
            npo[20].BackColor = System.Drawing.Color.Transparent;
            npo[20].Location  = new System.Drawing.Point(400, 704);
            npo[20].Name      = "enemy2";
            npo[20].Size      = new System.Drawing.Size(196, 64);
            //
            // enemy3
            //
            npo[21].BackColor = System.Drawing.Color.Transparent;
            npo[21].Location  = new System.Drawing.Point(777, 704);
            npo[21].Name      = "enemy3";
            npo[21].Size      = new System.Drawing.Size(128, 64);
            //
            // enemy4
            //
            npo[22].BackColor = System.Drawing.Color.Transparent;
            npo[22].Location  = new System.Drawing.Point(777, 314);
            npo[22].Name      = "enemy4";
            npo[22].Size      = new System.Drawing.Size(54, 216);
            //
            // enemy5
            //
            npo[23].BackColor = System.Drawing.Color.Transparent;
            npo[23].Location  = new System.Drawing.Point(720, 364);
            npo[23].Name      = "enemy5";
            npo[23].Size      = new System.Drawing.Size(53, 44);
            //
            // enemy6
            //
            npo[24].BackColor = System.Drawing.Color.Transparent;
            npo[24].Location  = new System.Drawing.Point(582, 243);
            npo[24].Name      = "enemy6";
            npo[24].Size      = new System.Drawing.Size(50, 153);
            //
            // enemy7
            //
            npo[25].BackColor = System.Drawing.Color.Transparent;
            npo[25].Location  = new System.Drawing.Point(191, 192);
            npo[25].Name      = "enemy7";
            npo[25].Size      = new System.Drawing.Size(51, 44);
            //
            // enemy8
            //
            npo[26].BackColor = System.Drawing.Color.Transparent;
            npo[26].Location  = new System.Drawing.Point(-1, 37);
            npo[26].Name      = "enemy8";
            npo[26].Size      = new System.Drawing.Size(41, 58);
            //
            // enemy9
            //
            npo[27].BackColor = System.Drawing.Color.Transparent;
            npo[27].Location  = new System.Drawing.Point(596, -2);
            npo[27].Name      = "enemy9";
            npo[27].Size      = new System.Drawing.Size(48, 76);
            //
            // enemy10
            //
            npo[28].BackColor = System.Drawing.Color.Transparent;
            npo[28].Location  = new System.Drawing.Point(719, 106);
            npo[28].Name      = "enemy10";
            npo[28].Size      = new System.Drawing.Size(50, 100);
            //
            // enemy11
            //
            npo[29].BackColor = System.Drawing.Color.Transparent;
            npo[29].Location  = new System.Drawing.Point(826, 0);
            npo[29].Name      = "enemy11";
            npo[29].Size      = new System.Drawing.Size(58, 95);
            //
            // diamond1red
            //
            npo[30].BackColor = System.Drawing.Color.Transparent;
            npo[30].Image     = global::TheSurvivor.Properties.Resources.DiamondRed;
            npo[30].Location  = new System.Drawing.Point(8, 533);
            npo[30].Name      = "diamond1red";
            npo[30].Size      = new System.Drawing.Size(36, 30);
            npo[30].SizeMode  = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            //
            // diamond2blue
            //
            npo[31].BackColor = System.Drawing.Color.Transparent;
            npo[31].Image     = global::TheSurvivor.Properties.Resources.DiamondBlue;
            npo[31].Location  = new System.Drawing.Point(804, 653);
            npo[31].Name      = "diamond2blue";
            npo[31].Size      = new System.Drawing.Size(36, 29);
            npo[31].SizeMode  = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            npo[31].SendToBack();
            //
            // diamond3red
            //
            npo[32].BackColor = System.Drawing.Color.Transparent;
            npo[32].Image     = global::TheSurvivor.Properties.Resources.DiamondRed;
            npo[32].Location  = new System.Drawing.Point(983, 196);
            npo[32].Name      = "diamond3red";
            npo[32].Size      = new System.Drawing.Size(36, 29);
            npo[32].SizeMode  = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            //
            // diamond4blue
            //
            npo[33].BackColor = System.Drawing.Color.Transparent;
            npo[33].Image     = global::TheSurvivor.Properties.Resources.DiamondBlue;
            npo[33].Location  = new System.Drawing.Point(744, 445);
            npo[33].Name      = "diamond4blue";
            npo[33].Size      = new System.Drawing.Size(36, 29);
            npo[33].SizeMode  = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            //
            // diamond5blue
            //
            npo[34].BackColor = System.Drawing.Color.Transparent;
            npo[34].Image     = global::TheSurvivor.Properties.Resources.DiamondBlue;
            npo[34].Location  = new System.Drawing.Point(295, 421);
            npo[34].Name      = "diamond5blue";
            npo[34].Size      = new System.Drawing.Size(36, 29);
            npo[34].SizeMode  = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            //
            // diamond6blue
            //
            npo[35].BackColor = System.Drawing.Color.Transparent;
            npo[35].Image     = global::TheSurvivor.Properties.Resources.DiamondBlue;
            npo[35].Location  = new System.Drawing.Point(362, 108);
            npo[35].Name      = "diamond6blue";
            npo[35].Size      = new System.Drawing.Size(36, 29);
            npo[35].SizeMode  = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            //
            // diamond7red
            //
            npo[36].BackColor = System.Drawing.Color.Transparent;
            npo[36].Image     = global::TheSurvivor.Properties.Resources.DiamondRed;
            npo[36].Location  = new System.Drawing.Point(0, 2);
            npo[36].Name      = "diamond7red";
            npo[36].Size      = new System.Drawing.Size(36, 29);
            npo[36].SizeMode  = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            //
            // movingFloor1
            //
            npo[37].BackColor = System.Drawing.Color.Transparent;
            npo[37].Image     = global::TheSurvivor.Properties.Resources.FloorBlueSmall;
            npo[37].Location  = new System.Drawing.Point(394, 670);
            npo[37].Name      = "movingFloor1";
            npo[37].Size      = new System.Drawing.Size(70, 26);
            npo[37].SizeMode  = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            npo[37].StartX    = npo[37].Left;
            npo[37].StartY    = npo[37].Top;
            //
            // movingFloor2
            //
            npo[38].BackColor = System.Drawing.Color.Transparent;
            npo[38].Image     = global::TheSurvivor.Properties.Resources.FloorDouble;
            npo[38].Location  = new System.Drawing.Point(639, 328);
            npo[38].Name      = "movingFloor2";
            npo[38].Size      = new System.Drawing.Size(137, 27);
            npo[38].SizeMode  = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            npo[38].StartX    = npo[38].Left;
            npo[38].StartY    = npo[38].Top;
            //
            // movingFloor3
            //
            npo[39].BackColor = System.Drawing.Color.Transparent;
            npo[39].Image     = global::TheSurvivor.Properties.Resources.FloorBlueSmall;
            npo[39].Location  = new System.Drawing.Point(390, 219);
            npo[39].Name      = "movingFloor3";
            npo[39].Size      = new System.Drawing.Size(117, 33);
            npo[39].SizeMode  = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            npo[39].StartX    = npo[39].Left;
            npo[39].StartY    = npo[39].Top;
            //
            // movingEnemy1
            //
            npo[40].BackColor = System.Drawing.Color.Transparent;
            npo[40].Image     = global::TheSurvivor.Properties.Resources.EnemyShortAll;
            npo[40].Location  = new System.Drawing.Point(167, 523);
            npo[40].Name      = "movingEnemy1";
            npo[40].Size      = new System.Drawing.Size(54, 48);
            npo[40].SizeMode  = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            npo[40].StartX    = npo[40].Left;
            npo[40].StartY    = npo[40].Top;
            //
            // movingEnemy2
            //
            npo[41].BackColor = System.Drawing.Color.Transparent;
            npo[41].Image     = global::TheSurvivor.Properties.Resources.EnemyShortAll;
            npo[41].Location  = new System.Drawing.Point(287, 528);
            npo[41].Name      = "movingEnemy2";
            npo[41].Size      = new System.Drawing.Size(54, 48);
            npo[41].SizeMode  = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            npo[41].StartX    = npo[41].Left;
            npo[41].StartY    = npo[41].Top;
            //
            // movingEnemy3
            //
            npo[42].BackColor = System.Drawing.Color.Transparent;
            npo[42].Image     = global::TheSurvivor.Properties.Resources.EnemyShortAll;
            npo[42].Location  = new System.Drawing.Point(288, 303);
            npo[42].Name      = "movingEnemy3";
            npo[42].Size      = new System.Drawing.Size(54, 46);
            npo[42].SizeMode  = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            npo[42].StartX    = npo[42].Left;
            npo[42].StartY    = npo[42].Top;
            //
            // portal
            //
            npo[43].BackColor = System.Drawing.Color.Transparent;
            npo[43].Image     = global::TheSurvivor.Properties.Resources.Portal;
            npo[43].Location  = new System.Drawing.Point(969, 56);
            npo[43].Name      = "portal";
            npo[43].Size      = new System.Drawing.Size(39, 74);
            npo[43].SizeMode  = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            //
            // player
            //
            player.BackColor = System.Drawing.Color.Transparent;
            player.Image     = global::TheSurvivor.Properties.Resources.IdleRightSmall;
            player.Location  = new System.Drawing.Point(9, 692);
            player.Name      = "myPlayer";
            player.Size      = new System.Drawing.Size(36, 50);
            player.SizeMode  = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            //
            // ladder1
            //
            ladder1.Location = new System.Drawing.Point(980, 531);
            ladder1.Name     = "ladder1";
            ladder1.Size     = new System.Drawing.Size(44, 211);
            ladder1.Visible  = false;
            //
            // ladder2
            //
            ladder2.Location = new System.Drawing.Point(830, 412);
            ladder2.Name     = "ladder2";
            ladder2.Size     = new System.Drawing.Size(54, 112);
            ladder2.Visible  = false;
            //
            // ladder3
            //
            ladder3.Location = new System.Drawing.Point(45, 343);
            ladder3.Name     = "ladder3";
            ladder3.Size     = new System.Drawing.Size(40, 152);
            ladder3.Visible  = false;
            //
            // ladder4
            //
            ladder4.Location = new System.Drawing.Point(530, 253);
            ladder4.Name     = "ladder4";
            ladder4.Size     = new System.Drawing.Size(44, 80);
            ladder4.Visible  = false;

            //hiding
            for (int i = 0; i < 30; i++)
            {
                npo[i].Visible = false;
            }
            //adding
            for (int i = 0; i < 44; i++)
            {
                this.Controls.Add(npo[i]);
            }
            this.Controls.Add(player);
        }
Ejemplo n.º 8
0
 public void WorldCollision(NonPlayer npo)
 {
     if (this.Bottom > npo.Top && this.Bottom < npo.Bottom)                                                  // comming from top
     {                                                                                                       //this is where stuff getting a bit tricky
         //comming FROM left TO right , 7 cause gravity max +1, concidering i fall full speed
         if (this.Bottom > (npo.Top + 7) && this.Right < (npo.Left + velocity + 3) && this.Right > npo.Left) //small green part on the left
         {
             if (!npo.SideEffect)
             {
                 this.Left = (npo.Left - this.Width - 1);//-1 testable
                 return;
             }
             else
             {
                 npo.wtd();
                 return;
             }
         }
         //comming FROM right TO left , 7 cause gravity max +1, concidering i fall full speed
         else if (this.Bottom > (npo.Top + 7) && (this.Left > npo.Right - velocity - 3) && this.Left < npo.Right)//small yellow part right
         {
             if (!npo.SideEffect)
             {
                 this.Left = npo.Right + 1;//+1 testable
                 return;
             }
             else
             {
                 npo.wtd();
                 return;
             }
         }
         //really comming from top!
         else if (this.Right > npo.Left && this.Left < npo.Right) // all the other red shit (top)
         {
             if (!npo.SideEffect)
             {
                 this.Top = (npo.Top - this.Height); //-1 testable
                 jump     = true;
                 gravity  = 0f;                      //gravity = platforms speed + direction
                 return;
             }
             else
             {
                 npo.wtd();
                 return;
             }
         }
     }
     //comming from bottom!!
     else if (this.Top < npo.Bottom && this.Top > npo.Top)
     {                                                                                                       //comming FROM left TO right , 7 for now, depends on gravity and how u guys would like to poof ; extreme when jumping 0 distance
         if (this.Top < (npo.Bottom - 7) && this.Right > npo.Left && this.Right < (npo.Left + velocity + 1)) //all green part left
         {
             if (!npo.SideEffect)
             {
                 this.Left = (npo.Left - this.Width);//-1 testable
                 return;
             }
             else
             {
                 npo.wtd();
                 return;
             }
         }
         //comming FROM right TO left , 7 for now, depends on gravity and how u guys would like to poof ; extreme when jumping 0 distance
         else if (this.Top < (npo.Bottom - 7) && this.Left < npo.Right && this.Left > (npo.Right - velocity - 1))//all yellow part right
         {
             if (!npo.SideEffect)
             {
                 this.Left = npo.Right;//+1 testable
                 return;
             }
             else
             {
                 npo.wtd();
                 return;
             }
         }
         //really coming from bottom!
         else if (this.Right > npo.Left && this.Left < npo.Right)//all the other red shit (bottom)
         {
             if (!npo.SideEffect)
             {
                 this.Top = npo.Bottom; //+1 testable
                 gravity  = 0;          //gravity = platforms speed + direction
                 return;
             }
             else
             {
                 npo.wtd();
                 return;
             }
         }
     }
     // comming from either side **only happens if player higher than platform**
     else if (this.Top < npo.Top && this.Bottom > npo.Bottom)
     {   // comming FROM left TO right
         if (this.Right > npo.Left && this.Left < npo.Left)
         {
             if (!npo.SideEffect)
             {
                 this.Left = (npo.Left - this.Width);//-1 testable
                 return;
             }
             else
             {
                 npo.wtd();
                 return;
             }
         }
         //comming FROM right TO left
         else if (this.Left < npo.Right && this.Right > npo.Right)
         {
             if (!npo.SideEffect)
             {
                 this.Left = npo.Right;//+1 testable
                 return;
             }
             else
             {
                 npo.wtd();
                 return;
             }
         }
     }
 }
Ejemplo n.º 9
0
        private void InitializeMyComponenets()
        {
            //
            //archer floor
            //
            npo[0]          = new NonPlayer(false, false, 0, Direction.None);
            npo[0].Location = new System.Drawing.Point(850, 373);
            npo[0].Name     = "Archer_floor";
            npo[0].Size     = new System.Drawing.Size(100, 50);
            npo[0].Visible  = false;
            //
            // starting platfoorm
            //
            npo[1] = new NonPlayer(false, false, 0, Direction.None);
            npo[1].BackgroundImageLayout = ImageLayout.None;
            npo[1].Location = new System.Drawing.Point(0, 622);
            npo[1].Name     = "starting_platform";
            npo[1].Size     = new System.Drawing.Size(163, 118);
            npo[1].Visible  = false;
            //
            //platform 1
            //
            npo[2] = new NonPlayer(false, false, 0, Direction.None);
            npo[2].BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
            npo[2].Location = new System.Drawing.Point(237, 470);
            npo[2].Name     = "platform1";
            npo[2].Size     = new System.Drawing.Size(159, 88);
            npo[2].Visible  = false;
            //
            //platform 2
            //
            npo[3] = new NonPlayer(false, false, 0, Direction.None);
            npo[3].BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
            npo[3].Location = new System.Drawing.Point(-44, 420);
            npo[3].Name     = "platform2";
            npo[3].Size     = new System.Drawing.Size(168, 99);
            npo[3].Visible  = false;
            //
            // platform 2.5
            //
            npo[4]      = new NonPlayer(false, false, 0, Direction.None);
            npo[4].Size = new System.Drawing.Size(80, 60);
            npo[4].BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
            npo[4].BackColor             = System.Drawing.Color.Transparent;
            npo[4].Location = new System.Drawing.Point(190, 576);
            npo[4].Name     = "new_platfom";
            npo[4].Visible  = false;
            //
            //platform 3
            //
            npo[5]          = new NonPlayer(false, false, 0, Direction.None, () => AddPoints(5));
            npo[5].Location = new System.Drawing.Point(133, 291);
            npo[5].Name     = "platform4";
            npo[5].Size     = new System.Drawing.Size(164, 42);
            npo[5].Visible  = false;
            //
            //enemy- spikes 1
            //
            npo[7]          = new NonPlayer(true, false, 0, Direction.None, LoseHP);
            npo[7].Location = new System.Drawing.Point(264, 248);
            npo[7].Name     = "spike1";
            npo[7].Size     = new System.Drawing.Size(163, 85);
            npo[7].Visible  = false;
            //
            //platform 5
            //
            npo[8]          = new NonPlayer(false, false, 0, Direction.None);
            npo[8].Location = new System.Drawing.Point(355, 215);
            npo[8].Name     = "platform5";
            npo[8].Size     = new System.Drawing.Size(147, 38);
            npo[8].Visible  = false;
            //
            // moving platfrom 1
            //
            npo[10]           = new NonPlayer(false, false, 400, (Direction.Up | Direction.Cycling));
            npo[10].BackColor = System.Drawing.Color.Transparent;
            npo[10].Image     = global::TheSurvivor.Properties.Resources.plat3_3;
            npo[10].Location  = new System.Drawing.Point(686, 600);
            npo[10].Name      = "moving_platform2";
            npo[10].Size      = new System.Drawing.Size(138, 37);
            npo[10].StartX    = npo[10].Left;
            npo[10].StartY    = npo[10].Top;
            //
            // moving platfrom 2 - enemy
            //
            npo[16]           = new NonPlayer(true, false, 400, (Direction.Down | Direction.Cycling), LoseHP);
            npo[16].BackColor = System.Drawing.Color.Transparent;
            npo[16].Image     = global::TheSurvivor.Properties.Resources.GreenSpike;
            npo[16].Location  = new System.Drawing.Point(686 - 140, 200);
            npo[16].Name      = "moving_platform2";
            npo[16].Size      = new System.Drawing.Size(100, 50);
            npo[16].StartX    = npo[16].Left;
            npo[16].StartY    = npo[16].Top;
            npo[16].BringToFront();
            //
            // end platform
            //
            npo[11]          = new NonPlayer(false, false, 0, Direction.None);
            npo[11].Location = new System.Drawing.Point(823, 667);
            npo[11].Name     = "end_platform";
            npo[11].Size     = new System.Drawing.Size(164, 73);
            npo[11].Visible  = false;
            //
            // portal
            //
            npo[12]          = new NonPlayer(false, true, 0, Direction.None, NextLevel);
            npo[12].Location = new System.Drawing.Point(909, 560);
            npo[12].Name     = "portal";
            npo[12].Size     = new System.Drawing.Size(88, 135);
            npo[12].Visible  = false;
            //
            //enemy - spike 2
            //
            npo[13]          = new NonPlayer(true, false, 0, Direction.None, LoseHP);
            npo[13].Location = new System.Drawing.Point(658, 661);
            npo[13].Name     = "spike2";
            npo[13].Size     = new System.Drawing.Size(166, 79);
            npo[13].Visible  = false;
            //
            // vine 1
            //
            npo[14]          = new NonPlayer(true, false, 0, Direction.None, LoseHP);
            npo[14].Location = new System.Drawing.Point(428, 248);
            npo[14].Name     = "vine1";
            npo[14].Size     = new System.Drawing.Size(52, 155);
            npo[14].Visible  = false;
            //
            // vine 2
            //
            npo[15]          = new NonPlayer(true, false, 0, Direction.None, LoseHP);
            npo[15].Location = new System.Drawing.Point(835, 1);
            npo[15].Name     = "vine2";
            npo[15].Size     = new System.Drawing.Size(47, 157);
            npo[15].Visible  = false;
            //
            //diamond 1
            //
            npo[6]           = new NonPlayer(false, true, 0, Direction.None, () => AddPoints(6));
            npo[6].BackColor = System.Drawing.Color.Transparent;
            npo[6].Image     = global::TheSurvivor.Properties.Resources.DiamondBlue;
            npo[6].Location  = new System.Drawing.Point(133, 248);
            npo[6].Name      = "diamond1";
            npo[6].Size      = new System.Drawing.Size(50, 45);
            npo[6].SendToBack();
            //
            //diamond 2
            //
            npo[9]           = new NonPlayer(false, true, 0, Direction.None, () => AddPoints(9));
            npo[9].BackColor = System.Drawing.Color.Transparent;
            npo[9].Image     = global::TheSurvivor.Properties.Resources.DiamondBlue;
            npo[9].Location  = new System.Drawing.Point(517, 416);
            npo[9].Name      = "diamond2";
            npo[9].Size      = new System.Drawing.Size(50, 45);
            npo[9].SendToBack();
            //
            //diamond 3
            //
            npo[17]           = new NonPlayer(false, true, 0, Direction.None, () => AddPoints(17));
            npo[17].BackColor = System.Drawing.Color.Transparent;
            npo[17].Image     = global::TheSurvivor.Properties.Resources.DiamondBlue;
            npo[17].Location  = new System.Drawing.Point(551, 490);
            npo[17].Name      = "diamond3";
            npo[17].Size      = new System.Drawing.Size(50, 45);
            npo[17].SendToBack();
            //
            //diamond 4
            //
            npo[18]           = new NonPlayer(false, true, 0, Direction.None, () => AddPoints(18));
            npo[18].BackColor = System.Drawing.Color.Transparent;
            npo[18].Image     = global::TheSurvivor.Properties.Resources.DiamondBlue;
            npo[18].Location  = new System.Drawing.Point(722, 300);
            npo[18].Name      = "diamond4";
            npo[18].Size      = new System.Drawing.Size(50, 45);
            npo[18].SendToBack();
            //
            // diamond 5
            //
            npo[19]           = new NonPlayer(false, true, 0, Direction.None, () => AddPoints(19));
            npo[19].BackColor = System.Drawing.Color.Transparent;
            npo[19].Image     = global::TheSurvivor.Properties.Resources.DiamondBlue;
            npo[19].Location  = new System.Drawing.Point(937, 481);
            npo[19].Name      = "diamond5";
            npo[19].Size      = new System.Drawing.Size(50, 50);
            //
            //enemy - floor 1
            //
            npo[20]           = new NonPlayer(true, false, 0, Direction.None, LoseHP);
            npo[20].BackColor = System.Drawing.Color.Transparent;
            npo[20].Location  = new System.Drawing.Point(486, 661);
            npo[20].Name      = "pictureBox1";
            npo[20].Size      = new System.Drawing.Size(166, 79);
            npo[20].Visible   = false;
            //
            //enemy - floor 2
            //
            npo[21]          = new NonPlayer(true, false, 0, Direction.None, LoseHP);
            npo[21].Location = new System.Drawing.Point(314, 661);
            npo[21].Name     = "pictureBox2";
            npo[21].Size     = new System.Drawing.Size(166, 79);
            npo[21].Visible  = false;
            //
            //enemy - floor 3
            //
            npo[22]          = new NonPlayer(true, false, 0, Direction.None, LoseHP);
            npo[22].Location = new System.Drawing.Point(142, 661);
            npo[22].Name     = "pictureBox3";
            npo[22].Size     = new System.Drawing.Size(166, 79);
            npo[22].Visible  = false;
            //
            //enemy - floor 4
            //
            npo[23]          = new NonPlayer(true, false, 0, Direction.None, LoseHP);
            npo[23].Location = new System.Drawing.Point(814, 622);
            npo[23].Name     = "pictureBox4";
            npo[23].Size     = new System.Drawing.Size(52, 56);
            npo[23].Visible  = false;
            //
            //enemy - knight
            //
            npo[24]           = new NonPlayer(true, false, 0, Direction.None, LoseHP);
            npo[24].BackColor = System.Drawing.Color.Transparent;
            npo[24].Image     = global::TheSurvivor.Properties.Resources.enemy_knight;
            npo[24].Location  = new System.Drawing.Point(850, 255);
            npo[24].Name      = "archer";
            npo[24].Size      = new System.Drawing.Size(107, 128);
            //
            //plyaer
            //
            player = new Player(respawn, velocity + 1);
            player.BringToFront();
            player.BackColor = System.Drawing.Color.Transparent;
            player.Image     = global::TheSurvivor.Properties.Resources.IdleRightSmall;
            player.Location  = new System.Drawing.Point(51, 550);
            player.Name      = "player";
            player.Size      = new System.Drawing.Size(30, 50);
            player.SizeMode  = System.Windows.Forms.PictureBoxSizeMode.StretchImage;

            foreach (NonPlayer n in npo)
            {
                this.Controls.Add(n);
            }

            this.Controls.Add(player);
        }