private void time1_Tick(object sender, EventArgs e) { //hlaupa gif spilar replayar index++; if (right == true && index % 15 == 0) { player.Image = Image.FromFile("marioandyoshi.gif"); } if (left == true && index % 15 == 0) { player.Image = Image.FromFile("marioandyoshi2.gif"); } //mario move if (right == true) { player.Left += 3; } if (left == true) { player.Left -= 3; } //jump if (jump == true) { //ef player hefur hopad adur player.Top -= force; force -= 1; } if (player.Top + player.Height >= screen.Height) { player.Top = screen.Height - player.Height;//fall hættir á bottinum if (jump == true) { player.Image = Image.FromFile("marioyoshi.png");//mynd breytist þegar player er buinn ad hoppa og stendur kyrr } jump = false; } else { player.Top += 5; } //þegar player dettur í hraunið if (player.Left + player.Width - 1 > lava.Left && player.Left + player.Width + 5 < lava.Left + lava.Width + player.Width && player.Top + player.Height >= lava.Top && player.Top < lava.Top) { player.Top = screen.Height - lava.Height - player.Height; if (player.Bounds.IntersectsWith(lava.Bounds)) { ; } { this.Visible = false; //þetta felur formið sem er verið ad spila í //anað form (victory) byrtist time1.Stop(); //stopa time one svo kodin runnar ekki þvi annars koma 100x forms Form2 rip = new Form2(); rip.Show(); } } //þetta ef fyrir þegar hann nær að klára levelið if (player.Left + player.Width - 1 > endpoint.Left && player.Left + player.Width + 5 < endpoint.Left + endpoint.Width + player.Width && player.Top + player.Height >= endpoint.Top && player.Top < endpoint.Top) { player.Top = screen.Height - endpoint.Height - player.Height; if (player.Bounds.IntersectsWith(endpoint.Bounds)) { ; } { this.Visible = false; //þetta felur formið sem er verið ad spila í //anað form (victory) byrtist time1.Stop(); //stopa time one svo kodin runnar ekki þvi annars koma 100x forms Level3 end = new Level3(); end.Show(); } } //moving woodenplanks if (block5.Left < this.Width) { block5.Left = block5.Left + 3; } else { block5.Left = 0; } if (block6.Left < this.Width) { block6.Left = block6.Left + 3; } else { block6.Left = 0; } //aðferðir Blokk(block1); Blokk(block2); Blokk(block3); Blokk(block4); Blokk(block5); Blokk(block6); }