Changeset 922 for 2010/23/hniemi
- Timestamp:
- 2010-06-16 16:04:10 (12 years ago)
- Location:
- 2010/23/hniemi/ShootEmUp
- Files:
-
- 3 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/23/hniemi/ShootEmUp/ShootEmUp/Alus.cs
r897 r922 13 13 private IntMeter hp; 14 14 private Weapon kaytossaOlevaAse; 15 16 public Weapon UsedWeapon { get { return kaytossaOlevaAse; } private set { } } 15 17 16 18 /// <summary> … … 80 82 } 81 83 84 public void TimerShoot(Timer sender) 85 { 86 PhysicsObject panos = kaytossaOlevaAse.Shoot(); 87 if (panos != null) 88 { 89 panos.Angle = this.Angle; 90 } 91 } 92 82 93 } 83 94 } -
2010/23/hniemi/ShootEmUp/ShootEmUp/Content/Content.contentproj
r873 r922 103 103 </Compile> 104 104 </ItemGroup> 105 <ItemGroup> 106 <Compile Include="loppuvastus1.png"> 107 <Name>loppuvastus1</Name> 108 <Importer>TextureImporter</Importer> 109 <Processor>TextureProcessor</Processor> 110 </Compile> 111 </ItemGroup> 112 <ItemGroup> 113 <Compile Include="photon.png"> 114 <Name>photon</Name> 115 <Importer>TextureImporter</Importer> 116 <Processor>TextureProcessor</Processor> 117 </Compile> 118 </ItemGroup> 105 119 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 106 120 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2010/23/hniemi/ShootEmUp/ShootEmUp/Content/obj/x86/Debug/ContentPipeline.xml
r897 r922 101 101 <Time>2010-06-16T09:14:17.8697171+03:00</Time> 102 102 </Item> 103 <Item> 104 <Source>loppuvastus1.png</Source> 105 <Name>loppuvastus1</Name> 106 <Importer>TextureImporter</Importer> 107 <Processor>TextureProcessor</Processor> 108 <Options>None</Options> 109 <Output>C:\MyTemp\hniemi\ShootEmUp\ShootEmUp\bin\x86\Debug\Content\loppuvastus1.xnb</Output> 110 <Time>2010-06-16T15:08:15.6390259+03:00</Time> 111 </Item> 112 <Item> 113 <Source>photon.png</Source> 114 <Name>photon</Name> 115 <Importer>TextureImporter</Importer> 116 <Processor>TextureProcessor</Processor> 117 <Options>None</Options> 118 <Output>C:\MyTemp\hniemi\ShootEmUp\ShootEmUp\bin\x86\Debug\Content\photon.xnb</Output> 119 <Time>2010-06-16T15:40:02.4717759+03:00</Time> 120 </Item> 103 121 <BuildSuccessful>true</BuildSuccessful> 104 122 <Settings> -
2010/23/hniemi/ShootEmUp/ShootEmUp/Muodostelma.cs
r776 r922 45 45 if (alukset != null){this.alukset = alukset;} 46 46 else { this.alukset = new List<Alus>(); } 47 if (reitti != null && reitti.Count > 0) lahtopiste = reitti[0];47 if (reitti != null && reitti.Count > 0) lahtopiste = new Vector(0, +900);//reitti[0]; 48 48 49 49 this.kellottaja = ajastin; … … 65 65 public void Start() 66 66 { 67 kellottaja. LimitTimes(alukset.Count);67 kellottaja.Start(alukset.Count); 68 68 69 69 kellottaja.Trigger += SendShip; -
2010/23/hniemi/ShootEmUp/ShootEmUp/Peli.cs
r897 r922 81 81 LataaKontrollit(pelaajaAlus); 82 82 //LataaTausta(kentanNumero); 83 LataaViholliset( );83 LataaViholliset(20, 4,10); 84 84 LataaHUD(); 85 85 } … … 129 129 pelaajaAlus.Mass = 100000; 130 130 131 weapons = new Weapon[ 2];131 weapons = new Weapon[3]; 132 132 133 133 weapons[0] = new Beam(1, 1); … … 137 137 ((Missile)weapons[1]).MissileCollision = AmmusOsuu; 138 138 139 weapons[2] = new Photon(1, 1); 140 ((Photon)weapons[2]).PhotonCollision = AmmusOsuu; 141 139 142 for (int i = 0; i < weapons.Length; i++) 140 143 { … … 143 146 144 147 Add(pelaajaAlus); 145 pelaajaAlus.SetWeapon(weapons[ 1]);148 pelaajaAlus.SetWeapon(weapons[2]); 146 149 147 150 AddCollisionHandler(pelaajaAlus, PelaajaTormaa); … … 168 171 Keyboard.Listen(Key.LeftControl, ButtonState.Down, Ammu, "Lopettaa pelin", pelaajaAlus); 169 172 Keyboard.Listen(Key.D1, ButtonState.Pressed, VaihdaAsetta, "Valitsee säde-aseen", 1); 170 Keyboard.Listen(Key.D2, ButtonState.Pressed, VaihdaAsetta, "Valitsee säde-aseen", 2); 173 Keyboard.Listen(Key.D2, ButtonState.Pressed, VaihdaAsetta, "Valitsee ohjuksen", 2); 174 Keyboard.Listen(Key.D3, ButtonState.Pressed, VaihdaAsetta, "Valitsee fotoniaseen", 2); 171 175 } 172 176 … … 190 194 void VaihdaAsetta(int aseenNumero) 191 195 { 192 if (aseenNumero > 0 && aseenNumero < 3)196 if (aseenNumero > 0 && aseenNumero < 4) 193 197 pelaajaAlus.SetWeapon(weapons[aseenNumero-1]); 194 198 } … … 209 213 /// TODO: Kentän numeron huomioiminen 210 214 /// </summary> 211 void LataaViholliset( )215 void LataaViholliset(int maara, double min, double max) 212 216 { 213 217 List<AikaTapahtuma> vihollistenTuloajat = new List<AikaTapahtuma>(); 214 vihollistenTuloajat.Add(new AikaTapahtuma(2, LahetaSatunnainenVihollislaivue, Level.Center.X - 80, Level.Top + 20 ) ); 215 vihollistenTuloajat.Add(new AikaTapahtuma(2, LahetaSatunnainenVihollislaivue, Level.Center.X, Level.Top + 20)); 216 vihollistenTuloajat.Add(new AikaTapahtuma(9, LahetaSatunnainenVihollislaivue, Level.Center.X + 80, Level.Top + 20)); 217 vihollistenTuloajat.Add(new AikaTapahtuma(9, LahetaSatunnainenVihollislaivue, Level.Center.X - 80, Level.Top + 20)); 218 vihollistenTuloajat.Add(new AikaTapahtuma(20, LahetaSatunnainenVihollislaivue, Level.Center.X, Level.Top + 20)); 219 vihollistenTuloajat.Add(new AikaTapahtuma(20, LahetaSatunnainenVihollislaivue, Level.Center.X + 80, Level.Top + 20)); 220 vihollistenTuloajat.Add(new AikaTapahtuma(15, LahetaSatunnainenVihollislaivue, Level.Center.X - 80, Level.Top + 20)); 221 vihollistenTuloajat.Add(new AikaTapahtuma(15, LahetaSatunnainenVihollislaivue, Level.Center.X, Level.Top + 20)); 222 vihollistenTuloajat.Add(new AikaTapahtuma(40, LahetaSatunnainenVihollislaivue, Level.Center.X + 80, Level.Top + 20)); 218 /* 219 for (int i = 0; i < maara; i++) 220 { 221 vihollistenTuloajat.Add(new AikaTapahtuma(2 + (i * 5), LahetaSatunnainenVihollislaivue, 4, 10)); 222 } 223 */ 224 vihollistenTuloajat.Add(new AikaTapahtuma(1/*2 + (maara * 7)*/, LahetaLoppupomo, 1, 20)); 223 225 224 226 foreach (AikaTapahtuma tapahtuma in vihollistenTuloajat) … … 226 228 Timer ajastin = new Timer(); 227 229 ajastin.Tag = tapahtuma.Lahtopaikka; 228 ajastin.LimitTimes(1);229 230 ajastin.Interval = tapahtuma.Aika; 230 231 ajastin.Trigger += tapahtuma.Tapahtuma; 231 232 Add(ajastin); 232 ajastin.Start( );233 ajastin.Start(1); 233 234 } 234 235 } … … 239 240 /// <param name="sender">Timerin tagissa on lähtökoordinaatti</param> 240 241 /// <param name="lahetysX">X-koordinaatti, josta muodostelma lähtee</param> 241 void LahetaPerusvihollinen(Timer sender) 242 { 242 void LahetaLoppupomo(Timer sender) 243 { 244 double taso = ((Vector)sender.Tag).X; 245 243 246 List<Alus> alukset = new List<Alus>(); 244 Image vihollisenKuva = LoadImage("vihollinen" + 1); 245 246 for (int i = 0; i < 10; i++) 247 { 248 alukset.Add(LuoVihollinen(vihollisenKuva, 1)); 249 Add(alukset[i]); 250 Angle alas = new Angle(); 251 alas.Degree = 270; 252 alukset[i].Angle = alas; 253 AddCollisionHandler(alukset[i], VihollinenTormaa); 254 } 255 256 double lahtoX = ((Vector)sender.Tag).X; 257 double lahtoY = ((Vector)sender.Tag).Y; 247 Image vihollisenKuva = LoadImage("loppuvastus" + 1); 248 alukset.Add(LuoVihollinen(vihollisenKuva, 400)); 249 alukset[0].Position = new Vector(0, Level.Top + 200); 250 alukset[0].Angle = Angle.Degrees(270); 251 Add(alukset[0]); 252 253 //Aseen säätö 254 Photon ase = new Photon(10, 10); 255 LisaData ammuksenData; 256 ammuksenData.Damage = 20; 257 ammuksenData.Rajahtaa = false; 258 ammuksenData.Tyyppi = "vihollinen"; 259 ase.Tag = ammuksenData; 260 alukset[0].Add(ase); 261 alukset[0].SetWeapon(ase); 262 alukset[0].UsedWeapon.IsVisible = false; 263 ase.PhotonCollision = AmmusOsuu; 264 265 Timer ampumaAjastin = new Timer(); 266 ampumaAjastin.Interval = 0.7; 267 ampumaAjastin.Trigger += alukset[0].TimerShoot; 268 Add(ampumaAjastin); 269 ampumaAjastin.Start(); 258 270 259 271 List<Vector> reitti = new List<Vector>(); 260 reitti.Add(new Vector(lahtoX, lahtoY)); 261 reitti.Add(new Vector(-40 +lahtoX, 0)); 262 reitti.Add(new Vector(100 + lahtoX, 0)); 263 reitti.Add(new Vector(Level.Center.X + lahtoX, Level.Bottom - alukset[0].Size.Y / 2 - 20)); 272 reitti.Add(new Vector(-200, Level.Top - 100 )); 273 reitti.Add(new Vector(200, Level.Top - 100)); 264 274 265 275 Muodostelma muodostelma = new Muodostelma(alukset, reitti, LuoLahettaja()); … … 279 289 Image vihollisenKuva = LoadImage("vihollinen" + RandomGen.NextInt(1,VIHOLLISKUVIA)); 280 290 281 for (int i = 0; i < 10; i++) 291 int min = (int)((Vector)sender.Tag).X; 292 int max = (int)((Vector)sender.Tag).Y; 293 int koko = RandomGen.NextInt(min, max); 294 295 for (int i = 0; i < koko; i++) 282 296 { 283 297 alukset.Add(LuoVihollinen(vihollisenKuva, 40)); … … 285 299 Angle alas = new Angle(); 286 300 alas.Degree = 270; 287 alukset[i].Angle = alas; 301 alukset[i].Angle = Angle.Degrees(270); 302 alukset[i].Position = new Vector(0, Level.Top + 200); 288 303 AddCollisionHandler(alukset[i], VihollinenTormaa); 289 304 } … … 386 401 void VihollinenTormaa(PhysicsObject tormaaja, PhysicsObject kohde) 387 402 { 388 if (kohde == exitZone) tormaaja.Destroy();403 if (kohde == exitZone) Remove(tormaaja); 389 404 390 405 } … … 426 441 } 427 442 428 public AikaTapahtuma(int aika, Timer.TriggerHandler tapahtuma, double x, double y)443 public AikaTapahtuma(int aika, Timer.TriggerHandler tapahtuma, double param1, double param2) 429 444 { 430 445 this.Aika = aika; 431 446 this.Tapahtuma = tapahtuma; 432 this.lahtopaikka = new Vector( x, y);447 this.lahtopaikka = new Vector(param1, param2); 433 448 } 434 449 } -
2010/23/hniemi/ShootEmUp/ShootEmUp/ShootEmUp.csproj.Debug.cachefile
r873 r922 10 10 Content\vihollinen3.xnb 11 11 Content\sade.xnb 12 Content\loppuvastus1.xnb 13 Content\photon.xnb -
2010/23/hniemi/ShootEmUp/ShootEmUp/Weapons.cs
r897 r922 16 16 } 17 17 18 /// <summary> 19 /// Sädease 20 /// </summary> 18 21 class Beam : Weapon 19 22 { … … 37 40 private void LisaaAani() 38 41 { 39 AttackSound = Game.LoadSoundEffect("pum");42 //AttackSound = Game.LoadSoundEffect("pum"); 40 43 ammus = Game.LoadImage("sade"); 41 44 } … … 95 98 private void LisaaAani() 96 99 { 97 AttackSound = Game.LoadSoundEffect("pum");100 //AttackSound = Game.LoadSoundEffect("pum"); 98 101 ammus = Game.LoadImage("ohjus"); 99 102 } … … 117 120 SetCollisionHandler(projectile, MissileCollision); 118 121 ShootProjectile(projectile, 1000); 119 //Game.Add(projectile);120 122 projectile.IgnoresExplosions = true; 121 123 projectile.IgnoresCollisionResponse = true; … … 130 132 } 131 133 } 134 135 class Photon : Weapon 136 { 137 private Image ammus; 138 public int Level { get; private set; } 139 public CollisionHandler PhotonCollision { get; set; } 140 public int Damage { get; set; } 141 142 public Photon(double width, double height): base(width, height) 143 { 144 Level = 1; 145 Damage = 20; 146 this.TimeBetweenUse = (new TimeSpan(0,0,0,0,150)); 147 Color = Color.Blue; 148 this.AddedToGame += LisaaAani; 149 150 //Tagi 151 LisaData ase; 152 ase.Damage = 20; 153 ase.Rajahtaa = true; 154 ase.Tyyppi = "oma"; 155 Tag = ammus; 156 } 157 158 /// <summary> 159 /// Lisää äänen 160 /// </summary> 161 private void LisaaAani() 162 { 163 //AttackSound = Game.LoadSoundEffect("pum"); 164 ammus = Game.LoadImage("photon"); 165 } 166 167 protected override void OnUse() 168 { 169 OnShoot(); 170 } 171 172 protected override PhysicsObject OnShoot() 173 { 174 175 if (!this.IsDestroyed()) 176 { 177 //Game.MessageDisplay.Add("Debug"); 178 PhysicsObject projectile = new PhysicsObject(Level * 15, Level * 15); 179 projectile.Shape = Shapes.Circle; 180 projectile.Position = this.Position; 181 projectile.Color = this.Color; 182 projectile.Image = this.ammus; 183 SetCollisionHandler(projectile, PhotonCollision); 184 ShootProjectile(projectile, 2000); 185 projectile.IgnoresExplosions = true; 186 projectile.IgnoresCollisionResponse = true; 187 projectile.Tag = this.Tag; 188 return projectile; 189 } 190 return null; 191 } 192 } 132 193 } -
2010/23/hniemi/ShootEmUp/ShootEmUp/obj/x86/Debug/ShootEmUp.csproj.FileListAbsolute.txt
r897 r922 32 32 C:\MyTemp\hniemi\ShootEmUp\ShootEmUp\bin\x86\Debug\Content\sade.xnb 33 33 C:\MyTemp\hniemi\ShootEmUp\ShootEmUp\bin\x86\Debug\Jypeli2.dll 34 C:\MyTemp\hniemi\ShootEmUp\ShootEmUp\bin\x86\Debug\Content\loppuvastus1.xnb 35 C:\MyTemp\hniemi\ShootEmUp\ShootEmUp\bin\x86\Debug\Content\photon.xnb -
2010/23/hniemi/ShootEmUp/ShootEmUp/obj/x86/Debug/cachefile-{72efbe00-2f1f-4e1d-9867-af4a5a7cd89e}-targetpath.txt
r873 r922 10 10 Content\vihollinen3.xnb 11 11 Content\sade.xnb 12 Content\loppuvastus1.xnb 13 Content\photon.xnb
Note: See TracChangeset
for help on using the changeset viewer.