- Timestamp:
- 2010-06-09 11:58:54 (13 years ago)
- Location:
- 2010/23/lavevake/Rise of darkness
- Files:
-
- 3 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/23/lavevake/Rise of darkness/Content/Content.contentproj
r566 r607 34 34 </ItemGroup> 35 35 <ItemGroup> 36 <Compile Include=" Ukko.bmp">37 <Name> Ukko</Name>36 <Compile Include="Kone 2.png"> 37 <Name>Kone 2</Name> 38 38 <Importer>TextureImporter</Importer> 39 39 <Processor>TextureProcessor</Processor> … … 41 41 </ItemGroup> 42 42 <ItemGroup> 43 <Compile Include="Kone.bmp"> 44 <Name>Kone</Name> 43 <Compile Include="hirviö.png"> 44 <Name>hirviö</Name> 45 <Importer>TextureImporter</Importer> 46 <Processor>TextureProcessor</Processor> 47 </Compile> 48 </ItemGroup> 49 <ItemGroup> 50 <Compile Include="Ukko 2.png"> 51 <Name>Ukko 2</Name> 45 52 <Importer>TextureImporter</Importer> 46 53 <Processor>TextureProcessor</Processor> -
2010/23/lavevake/Rise of darkness/Peli.cs
r566 r607 15 15 ValueDisplay pisteNaytto; 16 16 17 18 const double virtaMaara = 5000; 19 20 DoubleMeter virtaLaskuri; 21 ValueDisplay virtaNaytto; 22 BarGauge virtaNayttoBar; 23 17 24 PlatformCharacter pelaaja1; 18 25 PlatformCharacter hirviö; 19 26 int kenttaNro; // monesko kenttä on menossa 20 27 … … 28 35 // Luodaan pistelaskuri 29 36 pisteLaskuri = new IntMeter(0); 37 38 Timer laskuri = new Timer(); 39 laskuri.Interval = 1; 40 laskuri.Trigger += vahennaVirtaa; 41 Add (laskuri); 42 laskuri.Start(); 43 30 44 31 45 // luodaan pistelaskunäyttö … … 46 60 } 47 61 62 void vahennaVirtaa(Timer t) 63 { 64 MessageDisplay.Add("Virta väheni"); 65 } 66 48 67 void seuraavaKentta() 49 68 { … … 51 70 pisteLaskuri.Reset(); 52 71 72 Timer ajastin = new Timer(); 73 ajastin.Interval = 5; 74 ajastin.Trigger += new Timer.TriggerHandler(pelinloppu); 75 Add(ajastin); 76 ajastin.Enabled = true; 77 ajastin.Reset(); 53 78 kenttaNro += 1; // lisätään kenttänumeroa yhdellä 54 79 MessageDisplay.Add("Kenttä " + kenttaNro); 55 80 56 81 // Asetetaan painovoima 57 Gravity = new Vector(0, 0);82 Gravity = new Vector(0, -1000); 58 83 59 84 luoKentta(); … … 69 94 lisaaTaso(-200, -350); 70 95 lisaaTaso(0, -200); 96 lisaaTaso(100, -100); 71 97 72 98 lisaaMaali(); … … 77 103 { 78 104 PhysicsObject taso = PhysicsObject.CreateStaticObject(100, 30); 79 taso.Color = Color. White;105 taso.Color = Color.Green; 80 106 taso.X = x; 81 107 taso.Y = y; … … 87 113 pelaaja1 = new PlatformCharacter(40, 40); 88 114 pelaaja1.Mass = 4.0; 89 pelaaja1.Image = LoadImage("Ukko ");115 pelaaja1.Image = LoadImage("Ukko 2"); 90 116 pelaaja1.X = 0; 91 pelaaja1.Y = Level.Bottom ; 117 pelaaja1.Y = Level.Bottom; 118 119 hirviö = new PlatformCharacter(80, 80); 120 hirviö.Mass = 4.0; 121 hirviö.Image = LoadImage("hirviö"); 122 hirviö.X = 100; 123 hirviö.Y = -120; 92 124 93 125 AddCollisionHandler(pelaaja1, osuiMaaliin); 94 126 127 AddCollisionHandler(pelaaja1, KasitteleTormays); 128 95 129 Add(pelaaja1); 130 Add(hirviö); 96 131 } 97 132 … … 101 136 maali.Tag = "maali"; 102 137 maali.IgnoresCollisionResponse = true; 103 maali.X = 30;138 maali.X = 100; 104 139 maali.Y = -60; 105 maali.Image = LoadImage(" kone");140 maali.Image = LoadImage("Kone 2"); 106 141 Add(maali); 107 142 } … … 148 183 } 149 184 } 185 186 void pelinloppu(Timer sender) 187 { 188 189 TextDisplay loppu = new TextDisplay(); 190 loppu.Position = Screen.Center; 191 loppu.TextColor = Color.Red; 192 Add(loppu); 193 loppu.Text = "Peli loppu"; 194 195 Timer lopetus = new Timer(); 196 lopetus.Interval = 2; 197 lopetus.Trigger += new Timer.TriggerHandler(lopetaPeli); 198 Add(lopetus); 199 lopetus.Enabled = true; 200 } 201 202 void lopetaPeli(Timer sender) 203 { 204 Exit(); 205 } 206 207 void KasitteleTormays(PhysicsObject pelaaja1, PhysicsObject toinen) 208 { 209 if (toinen == hirviö) 210 { 211 TextDisplay loppu = new TextDisplay(); 212 loppu.Position = Screen.Center; 213 loppu.TextColor = Color.Red; 214 Add(loppu); 215 loppu.Text = "Peli loppu"; 216 217 Timer lopetus = new Timer(); 218 lopetus.Interval = 2; 219 lopetus.Trigger += new Timer.TriggerHandler(lopetaPeli); 220 Add(lopetus); 221 lopetus.Enabled = true; 222 223 } 224 } 225 226 227 void LuoNaytot() 228 { 229 // viestinäytön väri valkoiseksi, jotta näkyy 230 MessageDisplay.TextColor = Color.White; 231 232 // polttoainelaskuri ja näytöt 233 virtaLaskuri = new DoubleMeter(virtaMaara); 234 virtaLaskuri.MaxValue = virtaMaara; 235 virtaLaskuri.LowerAlertValue = 750; 236 virtaLaskuri.DefaultValue = virtaMaara; 237 virtaLaskuri.LowerAlertValue = 1500; 238 virtaLaskuri.LowerAlert += virtaUhkaaLoppua; 239 virtaLaskuri.LowerLimit += virtaLoppui; 240 241 virtaNayttoBar = new BarGauge(); 242 virtaNayttoBar.HorizontalOrigin = HorizontalAlignment.Left; 243 virtaNayttoBar.VerticalOrigin = VerticalAlignment.Top; 244 virtaNayttoBar.ValueColor = Color.Green; 245 virtaNayttoBar.Max = virtaMaara; 246 virtaNayttoBar.X = Screen.RightSafe - 80; 247 virtaNayttoBar.Y = Screen.TopSafe - 400; 248 virtaNayttoBar.Width = 30; 249 virtaNayttoBar.Height = 200; 250 virtaNayttoBar.BindTo(virtaLaskuri); 251 Add(virtaNayttoBar); 252 253 virtaNaytto = new ValueDisplay(); 254 virtaNaytto.HorizontalOrigin = HorizontalAlignment.Left; 255 virtaNaytto.VerticalOrigin = VerticalAlignment.Top; 256 virtaNaytto.TextColor = Color.Wheat; 257 virtaNaytto.ValueColor = Color.Wheat; 258 virtaNaytto.X = Screen.RightSafe - 330; 259 virtaNaytto.Y = Screen.TopSafe; 260 virtaNaytto.BindTo(virtaLaskuri); 261 virtaNaytto.Text = "Virtaa jäljellä: "; 262 Add(virtaNaytto); 263 } 264 void virtaUhkaaLoppua(double maara) 265 { 266 virtaNaytto.ValueColor = Color.Red; 267 virtaNayttoBar.ValueColor = Color.Red; 268 MessageDisplay.Add("Varoitus: virta alkaa olla vähissä!"); 269 } 270 void virtaLoppui(double polttoAineMaara) 271 { 272 MessageDisplay.Add("Varoitus: virta loppui!"); 273 } 150 274 } 151 275 }
Note: See TracChangeset
for help on using the changeset viewer.