- Timestamp:
- 2011-06-30 15:00:26 (12 years ago)
- Location:
- 2011/26/JaniN/neon wars/neon wars
- Files:
-
- 5 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
2011/26/JaniN/neon wars/neon wars/neon wars/Peli.cs
r2314 r2380 29 29 public class Peli : PhysicsGame 30 30 { 31 ScoreList topLista = new ScoreList(10, false, 0); 31 32 Pelaaja pelaaja; 33 PushButton korkeusnappi; 34 PushButton leveysnappi; 35 PushButton näytäPistelistaNappi; 32 36 GameObject pyssy; 33 37 int montakoVihollistaLuotu = 0; 34 38 int montakoVihollistaLuodaan = 1; 35 39 PhysicsObject alareuna; 36 int pisteet = 0;40 //int pisteet = 0; 37 41 bool ladattu = true; 38 Label pistelaskuri;42 //Label pistelaskuri; 39 43 int vihollisia; 40 44 int montakoVihollistaRuudullaEnintaan = 10; … … 43 47 Image peliloppui = LoadImage("gameover"); 44 48 int kentanLeveys = 400; 45 int kentanKorkeus = 380; 46 49 int kentanKorkeus = 800; 50 //int pMaxMaara = 200; 51 ExplosionSystem rajahdys =new ExplosionSystem(LoadImage("rajahdys"), 1000); 52 Timer latausajastin = new Timer(); 53 Timer vihollistenLuontiAjastin = new Timer(); 54 Timer vihollistenLuomisenNopeutus = new Timer(); 55 56 int vaikeus = 0; 47 57 48 58 public override void Begin() … … 51 61 Keyboard.Listen(Key.Enter, ButtonState.Released, Start_game, null); 52 62 aloitusruudunnappulat(); 63 if (DataStorage.Exists("pisteet.xml")) 64 topLista = DataStorage.Load<ScoreList>(topLista, "pisteet.xml"); 65 66 67 53 68 } 54 69 … … 56 71 { 57 72 ClearAll(); 58 59 //Level.Width = Level.Width * 2; 60 Level.Width = kentanLeveys; 61 //Level.Height = Level.Height * 2; 62 //Level.Height = Level.Height / 2; 73 rajahdys = new ExplosionSystem(LoadImage("rajahdys"), 1000); 74 63 75 aseta_näppäimet(); 64 76 Mouse.IsCursorVisible = true; 65 77 Camera.ZoomToLevel(); 66 Timer latausajastin = new Timer(); 78 67 79 latausajastin.Interval = 0.03; 68 80 latausajastin.Trigger += new Timer.TriggerHandler(latausajastin_Trigger); 69 81 latausajastin.Start(); 70 71 82 72 83 vihollisia = 0; … … 76 87 77 88 Level.BackgroundColor = Color.DarkCyan; 78 79 80 Timer vihollistenLuontiAjastin = new Timer(); 89 81 90 vihollistenLuontiAjastin.Interval = 1; 82 91 vihollistenLuontiAjastin.Trigger += TeeVihollisia; 83 92 vihollistenLuontiAjastin.Start(); 84 //TeeVihollinen(ajastin); 85 86 Timer vihollistenLuomisenNopeutus = new Timer(); 93 94 vihollistenLuomisenNopeutus = new Timer(); 87 95 vihollistenLuomisenNopeutus.Interval = 5; // Kuinka monen sekunnin välein vihuja tulee lisää 88 96 vihollistenLuomisenNopeutus.Trigger += NopeutaVihollistenLuontia; … … 124 132 alareuna = Level.CreateBottomBorder(); 125 133 126 127 pistelaskuri = new Label(pisteet.ToString()); 128 pistelaskuri.Position = new Vector(Screen.Right - 40, Screen.Top - 10); 129 Add(pistelaskuri); 134 SoundEffect rajahdysAani = LoadSoundEffect("rajahdys"); 135 136 137 138 //pistelaskuri = new Label(pisteet.ToString()); 139 //pistelaskuri.Position = new Vector(Screen.Right - 40, Screen.Top - 10); 140 //Add(pistelaskuri); 141 142 if (RandomGen.NextBool()) 143 MediaPlayer.Play("Castlevania X(Saturn)"); 144 else 145 MediaPlayer.Play("Super Castlevania IV(SNES)"); 146 Add(rajahdys); 130 147 } 131 148 … … 135 152 Level.Background.Image = peliloppui; 136 153 Timer.SingleShot(3, Begin); 154 ajastintenpysaytys(); 137 155 } 138 156 … … 177 195 void ammus_Destroyed(PhysicsObject ammus) 178 196 { 179 Explosion rajahdys = new Explosion(70); 180 rajahdys.Position = ammus.Position; 181 rajahdys.Force = 0; 182 rajahdys.ShockwaveColor = Color.Transparent; 183 Add(rajahdys); 197 198 rajahdys.AddEffect(ammus.Position, 1000); 199 rajahdys.MaxScale = 8; 200 rajahdys.MinScale=4; 201 //rajahdys. 202 203 184 204 } 185 205 … … 207 227 void NopeutaVihollistenLuontia(Timer sender) 208 228 { 209 pisteet++;210 pistelaskuri.Text = pisteet.ToString();211 229 montakoVihollistaLuodaan += 1; 212 230 MessageDisplay.Add("aalto numero " + montakoVihollistaLuodaan); … … 241 259 Mouse.IsCursorVisible = true; 242 260 luonappi("Aloita peli", new Vector(0, 0), new Action(Start_game), Color.Aqua); 243 //luonappi(" 244 } 245 void luonappi(string Teksti, Vector paikka, Action action, Color väri) 261 korkeusnappi = luonappi("korkeus normi",new Vector(0,70),new Action(muutaKorkeutta),Color.Blue); 262 leveysnappi = luonappi("leveys normi", new Vector(0, -70), new Action(muutaLeveytta), Color.Red); 263 näytäPistelistaNappi = luonappi("pisteet", new Vector(170, 0), new Action(näytäPistelista), Color.Green); 264 } 265 PushButton luonappi(string Teksti, Vector paikka, Action action, Color väri) 246 266 { 247 267 PushButton nappi = new PushButton(Teksti); … … 250 270 nappi.Color = väri; 251 271 Add(nappi); 252 } 253 254 } 272 return nappi; 273 } 274 void ajastintenpysaytys() 275 { 276 latausajastin.Stop(); 277 vihollistenLuontiAjastin.Stop(); 278 vihollistenLuomisenNopeutus.Stop(); 279 } 280 void muutaKorkeutta() 281 { 282 vaikeus++; 283 vaikeus = vaikeus % 3; 284 285 switch (vaikeus) 286 { 287 case 0: Level.Height = kentanKorkeus; 288 korkeusnappi.Text = "korkeus=normi"; 289 break; 290 case 1: Level.Height = kentanKorkeus * 2; 291 korkeusnappi.Text = "korkeus=*2"; 292 break; 293 case 2: Level.Height = kentanKorkeus / 2; 294 korkeusnappi.Text = "korkeus=/2"; 295 break; 296 default: 297 break; 298 } 299 //Level.Height = Level.Height * 2; 300 //Level.Height = Level.Height / 2; 301 } 302 void muutaLeveytta() 303 { 304 vaikeus++; 305 vaikeus = vaikeus % 3; 306 307 switch (vaikeus) 308 { 309 case 0: Level.Width = kentanLeveys; 310 leveysnappi.Text = "leveys=normi"; 311 break; 312 case 1: Level.Width = kentanLeveys * 2; 313 leveysnappi.Text = "leveys=*2"; 314 break; 315 case 2: Level.Width = kentanLeveys / 2; 316 leveysnappi.Text = "leveys=/2"; 317 break; 318 default: 319 break; 320 } 321 //Level.Height = Level.Height * 2; 322 //Level.Height = Level.Height / 2; 323 324 } 325 //Level.Width = Level.Width * 2; 326 // Level.Width = kentanLeveys; 327 void näytäPistelista() 328 { 329 HighScoreWindow topIkkuna = new HighScoreWindow("Neon Wars", 330 "Parhaat pisteet", 331 topLista); 332 topIkkuna.Closed += TallennaPisteet; 333 Add(topIkkuna); 334 335 } 336 void TallennaPisteet(Window sender) 337 { 338 DataStorage.Save<ScoreList>(topLista, "pisteet.xml"); 339 340 } 341 } 342 343 // 344 // HighScoreWindow topIkkuna = new HighScoreWindow("Neon Wars", 345 // "Parhaat pisteet", 346 // topLista); 347 // topIkkuna.Closed += TallennaPisteet; 348 // Add(topIkkuna); -
2011/26/JaniN/neon wars/neon wars/neon warsContent/neon warsContent.contentproj
r2314 r2380 63 63 </Compile> 64 64 </ItemGroup> 65 <ItemGroup> 66 <Compile Include="Castlevania X%28Saturn%29.mp3"> 67 <Name>Castlevania X%28Saturn%29</Name> 68 <Importer>Mp3Importer</Importer> 69 <Processor>SongProcessor</Processor> 70 </Compile> 71 </ItemGroup> 72 <ItemGroup> 73 <Compile Include="Super Castlevania IV%28SNES%29.mp3"> 74 <Name>Super Castlevania IV%28SNES%29</Name> 75 <Importer>Mp3Importer</Importer> 76 <Processor>SongProcessor</Processor> 77 </Compile> 78 </ItemGroup> 79 <ItemGroup> 80 <Compile Include="rajahdys.png"> 81 <Name>rajahdys</Name> 82 <Importer>TextureImporter</Importer> 83 <Processor>TextureProcessor</Processor> 84 </Compile> 85 </ItemGroup> 65 86 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 66 87 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Note: See TracChangeset
for help on using the changeset viewer.