diff --git a/Financial_Freedom/Financial_Freedom/Financial_Freedom.cs b/Financial_Freedom/Financial_Freedom/Financial_Freedom.cs index af6baf558b52c1f9380e67c652fdebeb09cb8237..e69c80b657b5f21818798401afe49968f564b46d 100644 --- a/Financial_Freedom/Financial_Freedom/Financial_Freedom.cs +++ b/Financial_Freedom/Financial_Freedom/Financial_Freedom.cs @@ -15,6 +15,7 @@ using Jypeli.Widgets; using Microsoft.VisualBasic; using Silk.NET.Input; using Silk.NET.OpenAL; +using Silk.NET.OpenGL; using Silk.NET.SDL; using SixLabors.ImageSharp.Processing; using Button = Jypeli.Button; @@ -184,7 +185,7 @@ public class Financial_Freedom : PhysicsGame private Label bjVaihtoehdot; private Label pelaajanSummalab; - private PhysicsObject tero; + private GameObject tero; private PhysicsObject door; private List<GameObject> ovet; private int selectedDoor = -1; @@ -449,24 +450,24 @@ public class Financial_Freedom : PhysicsGame ovet = new List<GameObject>(); tero = null; - // Pelaaja - tero = new PlatformCharacter(Screen.Width/9, Screen.Height/4.5){ - Shape = Shape.Rectangle, - Position = new Vector(Screen.Left+150, Screen.Bottom+0.6*(Screen.Height/3)), - IgnoresCollisionResponse = true, - Image = LoadImage("tero.png") , - }; - Add(tero); - PhysicsObject door = new PhysicsObject(Screen.Width/11, Screen.Height/6); + GameObject door = new GameObject(Screen.Width/11, Screen.Height/6); door.Shape = Shape.Rectangle; door.Color = Color.Transparent; door.Position = new Vector(Screen.Width/3.6, Screen.Bottom+0.55*(Screen.Height/3)); door.Tag = "Door " + (7) + ": " + GetDoorDescription(7); - door.MakeStatic(); ovet.Add(door); Add(door); + // Pelaaja + tero = new GameObject(Screen.Width/9, Screen.Height/4.5){ + Shape = Shape.Rectangle, + Position = new Vector(Screen.Left+150, Screen.Bottom+0.6*(Screen.Height/3)), + //IgnoresCollisionResponse = true, + Image = LoadImage("tero.png") , + }; + Add(tero); + doorPopupLabel = new Label(""){ Position = new Vector(0, 200), TextColor = Color.White, @@ -531,28 +532,41 @@ public class Financial_Freedom : PhysicsGame LuoPistelaskuri(); var pakka = LuoPakka(); SekoitaPakka(pakka); - + int ovicount = 6; // Tekee viis ovea + int frame = 5; ovet = new List<GameObject>(); double doorSpacing = Screen.Width / 7; double startX = -Screen.Width / 3; for (int i = 0; i < ovicount; i++) { - PhysicsObject door = new PhysicsObject(Screen.Width / 10, Screen.Height / 3); + GameObject doorframe = new GameObject(Screen.Width / 10+frame, Screen.Height / 3+frame); + //door.Shape = Shape.Rectangle; + doorframe.Color = Color.Black; + //door.Image = LoadImage("door.png"); + doorframe.Position = new Vector(startX + i * doorSpacing, Screen.Bottom + 0.6 * (Screen.Height / 3)); + + GameObject door = new GameObject(Screen.Width / 10, Screen.Height / 3); //door.Shape = Shape.Rectangle; door.Color = Color.Brown; - door.Image = LoadImage("door.png"); - door.Position = new Vector(startX + i * doorSpacing, Screen.Bottom + 0.75 * (Screen.Height / 3)); - door.MakeStatic(); + //door.Image = LoadImage("door.png"); + door.Position = new Vector(startX + i * doorSpacing, Screen.Bottom + 0.6 * (Screen.Height / 3)); door.Tag = "Door " + (i + 1) + ": " + GetDoorDescription(i + 1); - Add(door); + + GameObject knob = new GameObject(15, 15, Shape.Circle) + { + Position = new Vector(startX + i * doorSpacing - door.Width/2.5, Screen.Bottom + 0.6 * (Screen.Height / 3)), + Color = Color.Gold, + }; + MiniPeliLogo(this, door.Width, door.Height / 2, door.X, door.Y + (0.8 * door.Height), alkulogot[i], i); + Add(doorframe); + Add(door); + Add(knob); Console.WriteLine($"door {door.Tag} added"); ovet.Add(door); - - if (i == ovicount-1){CreatePelaaja();} } // popup tekstit @@ -565,6 +579,8 @@ public class Financial_Freedom : PhysicsGame Size = new Vector(300, 50) }; + CreatePelaaja(); + Keyboard.Listen(Key.Space, ButtonState.Pressed, SelectDoor, "Select a door"); Keyboard.Listen(Key.Enter, ButtonState.Pressed, SelectDoor, "Select a door"); @@ -575,19 +591,15 @@ public class Financial_Freedom : PhysicsGame void CreatePelaaja() { - - tero = new PhysicsObject(Screen.Width / 6, Screen.Height / 3) + tero = new GameObject(Screen.Width / 6, Screen.Height / 4) { Shape = Shape.Rectangle, - Position = new Vector(Screen.Left + 150, Screen.Bottom + 0.6 * (Screen.Height / 3)), - IgnoresCollisionResponse = true, + Position = new Vector(Screen.Left + 150, Screen.Bottom + 0.5 * (Screen.Height / 3)), + //IgnoresCollisionResponse = true, Image = LoadImage("tero.png"), }; Add(tero); Console.WriteLine("tero added"); - - Remove(tero); - Add(tero); } // Returns a sample description based on door number.