- Timestamp:
- 2014-07-23 23:44:29 (9 years ago)
- Location:
- 2014/30/MikkoL/Gradiant/LM2
- Files:
-
- 1 added
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
2014/30/MikkoL/Gradiant/LM2/LM2/Gradiant.cs
r5597 r5608 96 96 97 97 string currentlevel = "level_test"; 98 99 #region Images 98 100 99 101 //Player … … 138 140 Image border_bottom = LoadImage("border_top"); 139 141 //Backgrounds 140 Image earth = LoadImage("earth");142 Image stage1_bg = LoadImage("stage1_bg"); 141 143 Image stage2_bg = LoadImage("stage2_bg"); 142 // Explosion144 //Animations 143 145 private Animation explosion_anim; 144 146 private Animation droid_anim; … … 163 165 Image aj = LoadImage("aj-weed"); 164 166 165 //SFX 167 #endregion 168 169 #region SFX 170 166 171 SoundEffect hurtsfx = LoadSoundEffect("hurt"); 167 172 SoundEffect hitsfx = LoadSoundEffect("hit"); … … 172 177 SoundEffect enemy_shootsfx = LoadSoundEffect("enemy_shoot"); 173 178 179 #endregion 180 174 181 //Weapon 175 182 double wpn_shootRate = 0.1; … … 182 189 IntMeter drd_damageRatio = new IntMeter(1, 1, 20); 183 190 184 //drd types185 //1: spreadshot186 //3: laser187 188 191 //Collision ignore groups 189 192 //2: player bullets/enemy bullets … … 191 194 //4: powerups 192 195 196 ProgressBar healthBar; 193 197 Timer wpn_timer = new Timer(); 194 198 … … 316 320 void Start() 317 321 { 322 ClearControls(); 323 318 324 selectsfx.Play(); 319 325 MediaPlayer.Stop(); … … 321 327 black.Position = cntr; 322 328 black.Color = Color.Transparent; 323 black.FadeColorTo(Color.Black, 1);329 black.FadeColorTo(Color.Black, 0.5); 324 330 Add(black, 2); 325 331 326 332 Timer wait = new Timer(); 327 wait.Interval = 1 .5;333 wait.Interval = 1; 328 334 wait.Timeout += delegate 329 335 { … … 364 370 if (!s001) 365 371 { 366 black.FadeColorTo(Color.Transparent, 1);367 372 black.FadeColorTo(Color.Transparent, 0.5); 373 Timer.SingleShot(0.5, AddHealthbar); 368 374 369 375 s001 = true; … … 377 383 if (!s002) 378 384 { 379 black.FadeColorTo(Color.Transparent, 1); 385 black.FadeColorTo(Color.Transparent, 0.5); 386 Timer.SingleShot(0.5, AddHealthbar); 380 387 381 388 s002 = true; … … 386 393 } 387 394 388 //Stage creation 395 #region Stage Creation 396 389 397 void CreateLevel(string level) 390 398 { … … 417 425 bg = new GameObject(1280, 800); 418 426 bg.Position = cntr; 419 bg.Image = earth;427 bg.Image = stage1_bg; 420 428 bg.MoveTo(cntr - new Vector(1280, 0), 900); 421 429 422 430 bg2 = new GameObject(1280, 800); 423 431 bg2.Position = cntr+new Vector(1280,0); 424 bg2.Image = earth;432 bg2.Image = stage1_bg; 425 433 bg2.MoveTo(cntr, 900); 426 434 … … 445 453 446 454 AddControls(); 447 AddHealthbar();448 455 449 456 Camera.Position = player.Position; … … 482 489 //edgeBorders(); 483 490 } 484 //Tiles for level 491 485 492 void border(Vector position, double width, double height) 486 493 { … … 500 507 border2.Color = Color.Transparent; 501 508 border2.Tag = "filler"; 509 border2.MaximumLifetime = TimeSpan.FromSeconds(1); 502 510 Add(border2, 1); 503 511 } … … 590 598 } 591 599 592 //Player related 600 #endregion 601 602 #region Player 603 593 604 void AddPlayer(Vector pos, double width, double height) 594 605 { … … 638 649 void AddHealthbar() 639 650 { 640 ProgressBarhealthBar = new ProgressBar(135, 10);651 healthBar = new ProgressBar(135, 10); 641 652 healthBar.BorderColor = Color.Black; 642 653 healthBar.Color = Color.Black; … … 739 750 } 740 751 741 742 //Weapon system 752 #endregion 753 754 #region Weapons 755 743 756 void shoot() 744 757 { … … 1018 1031 1019 1032 } 1020 1021 //Enemies 1033 1034 #endregion 1035 1036 #region Enemies 1037 1022 1038 void enemy_ship_1(Vector pos, double width, double height) 1023 1039 { … … 1452 1468 enemyship.IgnoresCollisionResponse = true; 1453 1469 enemyship.CollisionIgnoreGroup = 3; 1454 enemyship.health.MaxValue = 100;1470 enemyship.health.MaxValue = 70; 1455 1471 enemyship.Image = enemy_ship_06; 1456 1472 enemyship.explosion_scale = 70; … … 1618 1634 } 1619 1635 1620 //Bosses 1636 #endregion 1637 1638 #region Bosses 1639 1621 1640 void boss_ship_1(Vector pos, double width, double height) 1622 1641 { … … 1631 1650 boss_ship.Hit(stagespeed); 1632 1651 AddCollisionHandler<boss, frontborder>(boss_ship, boss_01_start); 1633 AddCollisionHandler<boss, bullet>(boss_ship, damageBoss);1634 1652 AddCollisionHandler<boss, player>(boss_ship, damagePlayerBossShip); 1635 1653 } … … 1646 1664 { 1647 1665 MediaPlayer.Play("Andross"); 1666 AddCollisionHandler<boss, bullet>(boss, damageBoss); 1648 1667 MediaPlayer.Volume = 1; 1649 1668 boss.Velocity = new Vector(0, 0); … … 1810 1829 } 1811 1830 1812 1813 //Power-ups 1831 #endregion 1832 1833 #region Power-ups 1834 1814 1835 void powerup(Vector pos) 1815 1836 { … … 1981 2002 } 1982 2003 1983 //Misc 2004 #endregion 2005 2006 #region Misc/Colliders 2007 1984 2008 void destroy(PhysicsObject p, PhysicsObject target) 1985 2009 { … … 2102 2126 void nextlevel() 2103 2127 { 2128 ClearControls(); 2129 2104 2130 if (currentlevel == "level_test") 2105 2131 { 2106 2132 SoundEffect.MasterVolume = 1; 2133 healthBar.Destroy(); 2107 2134 2108 2135 selectsfx.Play(); 2109 2136 stage_clear.Destroy(); 2110 MediaPlayer.Stop(); 2137 2138 Timer fade = new Timer(); 2139 fade.Interval = 0.03; 2140 fade.Timeout += delegate 2141 { 2142 MediaPlayer.Volume = MediaPlayer.Volume - 0.1; 2143 if (MediaPlayer.Volume == 0) 2144 { 2145 fade.Stop(); 2146 MediaPlayer.Stop(); 2147 MediaPlayer.Volume = 1; 2148 } 2149 }; 2150 fade.Start(); 2111 2151 2112 2152 black = new GameObject(Screen.Width,Screen.Height); … … 2115 2155 2116 2156 Add(black, 2); 2117 black.FadeColorTo(Color.Black, 1);2157 black.FadeColorTo(Color.Black, 0.5); 2118 2158 2119 2159 2120 2160 Timer wait = new Timer(); 2121 wait.Interval = 1 .5;2161 wait.Interval = 1; 2122 2162 wait.Timeout += delegate 2123 2163 { 2164 drd_level.Value = 0; 2165 wpn_damageRatio.Value = 1; 2166 wpn_spread.Value = 1; 2167 2124 2168 bg.Image = stage2_bg; 2125 2169 bg2.Image = stage2_bg; … … 2202 2246 } 2203 2247 } 2248 2249 #endregion 2204 2250 } -
2014/30/MikkoL/Gradiant/LM2/LM2Content/GradiantContent.contentproj
r5597 r5608 202 202 </ItemGroup> 203 203 <ItemGroup> 204 <Compile Include="space_bg.png">205 <Name>space_bg</Name>206 <Importer>TextureImporter</Importer>207 <Processor>TextureProcessor</Processor>208 </Compile>209 </ItemGroup>210 <ItemGroup>211 204 <Compile Include="bullet_enemy_02.png"> 212 205 <Name>bullet_enemy_02</Name> … … 223 216 </ItemGroup> 224 217 <ItemGroup> 225 <Compile Include=" earth.png">226 <Name> earth</Name>218 <Compile Include="stage1_bg.png"> 219 <Name>stage1_bg</Name> 227 220 <Importer>TextureImporter</Importer> 228 221 <Processor>TextureProcessor</Processor> -
2014/30/MikkoL/Gradiant/LM2/LM2Content/level_02.txt
r5597 r5608 21 21 @@ @@ 22 22 @@ @@ 23 @@ @ @@ 6 6623 @@ @ @@ 6 24 24 @@ @@ 25 25 @@ @@
Note: See TracChangeset
for help on using the changeset viewer.