private Surface[] VerschillendeLevels = new Surface[5]; // //Verschillende keuzes(2de startscherm) #endregion Fields #region Constructors public Manager() { play = new Audio(); //aanmaken audio audioThread = new Thread(new ThreadStart(play.PlayAudio));//starten tread laadTextarrays();//Aanmaken van textblock voor beginscherm startaf = new Surface("motherload_logo.png");//toewijzen van afb(1ste startscherm) Levelkeuze = new Surface("motherload_logo2.png");//toewijzen van afb(2de startscherm) LoseScreen = new Surface("explosion.png"); //Toewijzen afb eindscherm mVideo = Video.SetVideoMode(750,600);//Grote van window instellen Video.WindowCaption = "Motherload"; //Titel in titelbalk instellen speler = new Player();//aanmaken van speler level = new Level();//aanmaken van level gameObjecten = new List<GameObject>(); col = new CollisionDetection();//aanmaken van nieuw collisionDetection removeDirt = new RemoveDirt();//Aanmaken van Removedirt gameObjecten.Add(speler); laad = new LoadLevel(); Cheater = new CheatEngin(); audioThread.Start(); CreerLevens(); Events.Fps = 60; Events.KeyboardDown += Events_KeyboardDown; Events.Quit += Events_Quit; Events.Tick += Events_Tick; Events.Run(); }
void Events_KeyboardDown(object sender, SdlDotNet.Input.KeyboardEventArgs e) { if (startMenu == true)//Mag het startlenu getoont worden { if (e.Key == SdlDotNet.Input.Key.UpArrow)//freemode Up { if (beweeg.Y > 450) beweeg.Y -= 50; selctieboxje = new Box(beweeg, new Size(750, 50)); } if (e.Key == SdlDotNet.Input.Key.DownArrow) //Down { if (beweeg.Y < 550) beweeg.Y += 50; selctieboxje = new Box(beweeg, new Size(750, 50)); } } if (levela == true) //kan het twede startscherm getoond worden { if (e.Key == SdlDotNet.Input.Key.UpArrow)//freemode Up { if (levela == true) if (textvalue < 250) textvalue += 50; } if (e.Key == SdlDotNet.Input.Key.DownArrow) //Down { if (levela == true) if (textvalue > 100) textvalue -= 50; } } if(e.Key == SdlDotNet.Input.Key.Escape) { if ((Remaining.TotalMilliseconds <= 0 || speler.Levens <= 0) && end == true) { play.StopMusic(); esc = true; Events.QuitApplication(); PlayBoem = true; PlayYha = true; } if(col.GameEnd || Cheater.Enough) { speler = new Player(); level = new Level(); gameObjecten = new List<GameObject>(); col = new CollisionDetection(); removeDirt = new RemoveDirt(); gameObjecten.Add(speler); laad = new LoadLevel(); CreerLevens(); levela = true; Level1 = false; Level2= false; PlayBoem = true; PlayYha = true; kleur = Color.Green; } } if(e.Key==SdlDotNet.Input.Key.F1) { Cheater.CheatBaar = true; } if (e.Key == SdlDotNet.Input.Key.Return) { if (startMenu ==true) { if (beweeg.Y == 550) { Events.QuitApplication(); } else if (beweeg.Y == 500) { levela = true; startMenu = false; go = false; } else if (beweeg.Y == 450) { laad.LevelFile = "Level.txt"; initialize(); Free = true; end = true; go = false; } } if(levela == true) { if(textvalue == 100) { Events.QuitApplication(); } else if(textvalue ==150) { levela = false; Free = false; beweeg.Y = 450; textvalue = 250; startMenu = true; go = false; } else if(textvalue ==200) { laad.LevelFile = "Level2.txt"; initialize(); Time = DateTime.Now; Level2 = true; levela = false; end = true; } else if(textvalue == 250 && go ==true) { laad.LevelFile = "Level1.txt"; initialize(); Time = DateTime.Now; end = true; Level1 = true; levela = false; } go = true; } } }