- Timestamp:
- 2010-06-09 15:02:34 (13 years ago)
- Location:
- 2010/23/lavevake/Rise of darkness
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/23/lavevake/Rise of darkness/Content/Content.contentproj
r607 r643 54 54 </Compile> 55 55 </ItemGroup> 56 <ItemGroup> 57 <Compile Include="aurinko.png"> 58 <Name>aurinko</Name> 59 <Importer>TextureImporter</Importer> 60 <Processor>TextureProcessor</Processor> 61 </Compile> 62 </ItemGroup> 56 63 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 57 64 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2010/23/lavevake/Rise of darkness/Peli.cs
r607 r643 14 14 IntMeter pisteLaskuri; 15 15 ValueDisplay pisteNaytto; 16 Timer laskuri; 16 17 17 18 … … 24 25 PlatformCharacter pelaaja1; 25 26 PlatformCharacter hirviö; 27 PhysicsObject aurinko; 26 28 int kenttaNro; // monesko kenttä on menossa 27 29 … … 36 38 pisteLaskuri = new IntMeter(0); 37 39 38 Timer laskuri = new Timer(); 39 laskuri.Interval = 1; 40 laskuri.Trigger += vahennaVirtaa; 41 Add (laskuri); 42 laskuri.Start(); 40 41 42 43 43 44 44 … … 62 62 void vahennaVirtaa(Timer t) 63 63 { 64 MessageDisplay.Add("Virta väheni");64 virtaLaskuri.Value -= 100; 65 65 } 66 66 … … 69 69 ClearAll(); 70 70 pisteLaskuri.Reset(); 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(); 71 72 78 73 kenttaNro += 1; // lisätään kenttänumeroa yhdellä 79 74 MessageDisplay.Add("Kenttä " + kenttaNro); … … 85 80 lisaaNappaimet(); 86 81 Camera.Follow(pelaaja1); 82 LuoNaytot(); 83 laskuri = new Timer(); 84 laskuri.Interval = 0.1; 85 laskuri.Trigger += vahennaVirtaa; 86 Add(laskuri); 87 laskuri.Start(); 87 88 } 88 89 … … 123 124 hirviö.Y = -120; 124 125 126 aurinko = new PhysicsObject(40, 40); 127 aurinko.Mass = 4.0; 128 aurinko.Image = LoadImage("aurinko"); 129 aurinko.X = int luku.RandomGen.NextInt(-300,300) ; 130 aurinko.Y = -150; 131 125 132 AddCollisionHandler(pelaaja1, osuiMaaliin); 126 133 … … 129 136 Add(pelaaja1); 130 137 Add(hirviö); 138 Add(aurinko); 131 139 } 132 140 … … 183 191 } 184 192 } 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 193 202 194 void lopetaPeli(Timer sender) … … 204 196 Exit(); 205 197 } 206 198 207 199 void KasitteleTormays(PhysicsObject pelaaja1, PhysicsObject toinen) 208 200 { … … 213 205 loppu.TextColor = Color.Red; 214 206 Add(loppu); 215 loppu.Text = " Peli loppu";207 loppu.Text = "Kuolit.Peli loppu"; 216 208 217 209 Timer lopetus = new Timer(); … … 222 214 223 215 } 224 } 225 226 216 else if (toinen == aurinko) 217 { 218 virtaLaskuri.Value += 1000; 219 MessageDisplay.Add("Sait lisää energiaa."); 220 aurinko.Destroy(); 221 } 222 } 223 227 224 void LuoNaytot() 228 225 { … … 244 241 virtaNayttoBar.ValueColor = Color.Green; 245 242 virtaNayttoBar.Max = virtaMaara; 246 virtaNayttoBar.X = Screen.RightSafe - 80;247 virtaNayttoBar.Y = Screen.TopSafe - 400;243 virtaNayttoBar.X = Screen.RightSafe -20 ; 244 virtaNayttoBar.Y = Screen.TopSafe -20 ; 248 245 virtaNayttoBar.Width = 30; 249 246 virtaNayttoBar.Height = 200; … … 262 259 Add(virtaNaytto); 263 260 } 261 264 262 void virtaUhkaaLoppua(double maara) 265 263 { … … 268 266 MessageDisplay.Add("Varoitus: virta alkaa olla vähissä!"); 269 267 } 268 270 269 void virtaLoppui(double polttoAineMaara) 271 270 { 272 MessageDisplay.Add("Varoitus: virta loppui!"); 271 MessageDisplay.Add("Virta loppui!"); 272 TextDisplay loppu = new TextDisplay(); 273 loppu.Position = Screen.Center; 274 loppu.TextColor = Color.Red; 275 Add(loppu); 276 loppu.Text = "Epäonnistuit tehtävässäsi. Tohtori X:n suunnitelma on toteutunut ja maailma on peittynyt pimeyteen. Peli loppu"; 277 278 Timer lopetus = new Timer(); 279 lopetus.Interval = 2; 280 lopetus.Trigger += new Timer.TriggerHandler(lopetaPeli); 281 Add(lopetus); 282 lopetus.Enabled = true; 273 283 } 274 284 }
Note: See TracChangeset
for help on using the changeset viewer.