- Timestamp:
- 2012-06-09 14:44:52 (11 years ago)
- Location:
- 2012/23/JimB/FPS/FPS
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
2012/23/JimB/FPS/FPS/FPS/FPS/FPS.cs
r2897 r2898 15 15 public bool aseValmiina = true; //->Ei supersarjatulta. 16 16 public bool naattiValmiina = true; //->Ei naattispämmiä 17 18 17 public PeliUkko(double leveys, double korkeus) //double = desimaaliluku 19 18 : base(leveys, korkeus) //ottaa PeliUkon koon desimaaleina … … 30 29 IntMeter Pelaajat = new IntMeter(4); //Hengissä olevien pelaajien lukumäärä. 31 30 ExplosionSystem veri; //veripartikkelit 31 Dictionary<Color, Label> PlayerX = new Dictionary<Color, Label>(); 32 32 bool onkoPeliFullS = false; //fullscreen, 0 false, 1 true. 33 33 void ResetPelaajat() //resetoi pelaajien määrän neljään uuden pelin aloituksessa. … … 47 47 SetWindowSize(1024, 768, false); //false=ei Full, true = full 48 48 } 49 50 PlayerX.Add(Color.Blue, new Label()); 51 PlayerX.Add(Color.Yellow, new Label()); 52 PlayerX.Add(Color.Red, new Label()); 53 PlayerX.Add(Color.Purple, new Label()); 54 49 55 LuoKentta(); //kutsutaan kentänluonti 50 56 Veri(); //kutsutaan veripartikkelit … … 53 59 MediaPlayer.Volume = 0.5; 54 60 55 MessageDisplay.Add(" F1 - Näytä Ohjaimet"); //lisätään viestilaatikkoon ohje.61 MessageDisplay.Add(" F1 - Näytä Ohjaimet"); //lisätään viestilaatikkoon ohje. 56 62 Keyboard.Listen(Key.F1, ButtonState.Pressed, Ohjeet, "Näytä ohjaimet"); //Kutsutaan Ohjeet 57 63 Keyboard.Listen(Key.F11, ButtonState.Pressed, Fullscreen,null); … … 64 70 { 65 71 SetWindowSize(1024, 768, false); onkoPeliFullS = false; 66 // Camera.ZoomToLevel(); 72 Camera.ZoomToLevel(); 73 UpdateAllHP(); 67 74 return; 68 75 } … … 70 77 int h = Microsoft.Xna.Framework.Graphics.GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height; 71 78 SetWindowSize(w, h, true); onkoPeliFullS = true; 72 // Camera.ZoomToLevel(); 79 Camera.ZoomToLevel(); 80 UpdateAllHP(); 81 } 82 void LuoHPNaytot() 83 { 84 LuoHPNaytto(Screen.Left + 10, Screen.Top - 10, pelaaja1.Elamat, Color.Blue); 85 LuoHPNaytto(Screen.Right - 10, Screen.Top - 10, pelaaja2.Elamat, Color.Yellow); 86 LuoHPNaytto(Screen.Right - 10, Screen.Bottom + 10, pelaaja3.Elamat, Color.Red); 87 LuoHPNaytto(Screen.Left + 10, Screen.Bottom + 10, pelaaja4.Elamat, Color.Purple); 88 89 } 90 void UpdateAllHP() 91 { 92 UpdateHP(Screen.Left + 10 , Screen.Top - 10, Color.Blue); 93 UpdateHP(Screen.Right - 10, Screen.Top - 10, Color.Yellow); 94 UpdateHP(Screen.Right - 10, Screen.Bottom + 10, Color.Red); 95 UpdateHP(Screen.Left + 10, Screen.Bottom + 10, Color.Purple); 96 73 97 } 74 98 void Ohjeet() … … 78 102 MessageDisplay.Add("Pelaaja 3 - TFGH - R ampuminen - Y Kranaatti"); 79 103 MessageDisplay.Add("Pelaaja 4 - IJKL - U ampuminen - O Kranaatti"); 80 MessageDisplay.Add("F11 -> Fullscreen/Windowed *BUGS ON 16:10*");104 MessageDisplay.Add("F11 -> Fullscreen/Windowed"); 81 105 } 82 106 void LuoKentta() … … 93 117 Level.Background.Image = LoadImage("bg"); //Määritetään taustakuva. 94 118 Camera.ZoomToLevel(); 119 LuoHPNaytot(); 95 120 } 96 121 void LuoPalikka(Vector paikka, double leveys, double korkeus) … … 111 136 pelaaja1.Image = LoadImage("Pelaaja1"); 112 137 pelaaja1.CollisionIgnoreGroup = 1; //omat luodit eivät osu -> tämän pelaajan luodit ovat collisonignoregroup 1:ssä myös + kranaatit. 113 114 LuoHPNaytto(Screen.Left + 10, Screen.Top - 10, pelaaja1.Elamat, Color.Blue); 138 //LuoHPNaytto(Level.Left - 125, Level.Top + 100, pelaaja1.Elamat, Color.Blue); 115 139 116 140 //Kontrollit: … … 132 156 pelaaja2.Image = LoadImage("Pelaaja2"); 133 157 pelaaja2.CollisionIgnoreGroup = 2; 134 LuoHPNaytto(Screen.Right - 10, Screen.Top - 10, pelaaja2.Elamat, Color.Yellow);158 //LuoHPNaytto(Level.Right + 125, Level.Top + 100, pelaaja2.Elamat, Color.Yellow); 135 159 136 160 … … 152 176 pelaaja3.Image = LoadImage("Pelaaja3"); 153 177 pelaaja3.CollisionIgnoreGroup = 3; 154 LuoHPNaytto(Screen.Right - 10, Screen.Bottom + 10, pelaaja3.Elamat, Color.Red);178 //LuoHPNaytto(Level.Right + 125, Level.Bottom - 100, pelaaja3.Elamat, Color.Red); 155 179 156 180 … … 172 196 pelaaja4.Image = LoadImage("Pelaaja4"); 173 197 pelaaja4.CollisionIgnoreGroup = 4; 174 LuoHPNaytto(Screen.Left + 10, Screen.Bottom + 10, pelaaja4.Elamat, Color.Purple);198 //LuoHPNaytto(Level.Left - 125, Level.Bottom - 100, pelaaja4.Elamat, Color.Purple); 175 199 176 200 … … 259 283 void LuoHPNaytto(double x, double y, IntMeter sidottavaMittari, Color taustavari) 260 284 { 261 Label hp = new Label();285 Label hp = PlayerX[taustavari]; 262 286 hp.Color = taustavari; 263 287 hp.BindTo(sidottavaMittari); 264 288 hp.Position = new Vector(x, y); 265 289 Add(hp); 290 } 291 void UpdateHP(double x, double y, Color taustavari) 292 { 293 Label hp = PlayerX[taustavari]; 294 hp.Position = new Vector (x,y); 266 295 } 267 296 void Osuma(PeliUkko tormaaja, PhysicsObject ammus)
Note: See TracChangeset
for help on using the changeset viewer.