- Timestamp:
- 2010-06-17 15:59:38 (13 years ago)
- Location:
- 2010/23/hniemi/ShootEmUp
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/23/hniemi/ShootEmUp/ShootEmUp/Alus.cs
r932 r955 64 64 public void SetWeapon(Weapon ase) 65 65 { 66 kaytossaOlevaAse.IsVisible = false;67 ase.IsVisible = true;68 66 kaytossaOlevaAse = ase; 69 70 67 } 71 68 … … 78 75 if ( panos != null) { 79 76 panos.Angle = this.Angle; 80 } 81 77 } 82 78 } 83 79 84 public void TimerShoot(Timer sender) 80 /// <summary> 81 /// Ampuu silloin kun kutsutaan, timer-kutsuja varten 82 /// </summary> 83 /// <param name="sender">Ei käytössä</param> 84 public void Shoot(Timer sender) 85 85 { 86 PhysicsObject panos = kaytossaOlevaAse.Shoot();87 if (panos != null)88 {89 panos.Angle = this.Angle;90 91 }86 this.Shoot(); 87 //PhysicsObject panos = kaytossaOlevaAse.Shoot(); 88 //if (panos != null) 89 //{ 90 // panos.Angle = this.Angle; 91 //} 92 92 } 93 93 -
2010/23/hniemi/ShootEmUp/ShootEmUp/Content/Content.contentproj
r922 r955 117 117 </Compile> 118 118 </ItemGroup> 119 <ItemGroup> 120 <Compile Include="seina\seinaOikea.png"> 121 <Name>seinaOikea</Name> 122 <Importer>TextureImporter</Importer> 123 <Processor>TextureProcessor</Processor> 124 </Compile> 125 </ItemGroup> 126 <ItemGroup> 127 <Compile Include="seina\seinaKulma.png"> 128 <Name>seinaKulma</Name> 129 <Importer>TextureImporter</Importer> 130 <Processor>TextureProcessor</Processor> 131 </Compile> 132 </ItemGroup> 133 <ItemGroup> 134 <Compile Include="vihollinen4.png"> 135 <Name>vihollinen4</Name> 136 <Importer>TextureImporter</Importer> 137 <Processor>TextureProcessor</Processor> 138 </Compile> 139 </ItemGroup> 119 140 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 120 141 <!-- 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
r922 r955 119 119 <Time>2010-06-16T15:40:02.4717759+03:00</Time> 120 120 </Item> 121 <Item> 122 <Source>seina\seinaOikea.png</Source> 123 <Name>seina\seinaOikea</Name> 124 <Importer>TextureImporter</Importer> 125 <Processor>TextureProcessor</Processor> 126 <Options>None</Options> 127 <Output>C:\MyTemp\hniemi\ShootEmUp\ShootEmUp\bin\x86\Debug\Content\seina\seinaOikea.xnb</Output> 128 <Time>2010-06-17T14:23:38.7333064+03:00</Time> 129 </Item> 130 <Item> 131 <Source>seina\seinaKulma.png</Source> 132 <Name>seina\seinaKulma</Name> 133 <Importer>TextureImporter</Importer> 134 <Processor>TextureProcessor</Processor> 135 <Options>None</Options> 136 <Output>C:\MyTemp\hniemi\ShootEmUp\ShootEmUp\bin\x86\Debug\Content\seina\seinaKulma.xnb</Output> 137 <Time>2010-06-17T14:22:40.0307488+03:00</Time> 138 </Item> 139 <Item> 140 <Source>vihollinen4.png</Source> 141 <Name>vihollinen4</Name> 142 <Importer>TextureImporter</Importer> 143 <Processor>TextureProcessor</Processor> 144 <Options>None</Options> 145 <Output>C:\MyTemp\hniemi\ShootEmUp\ShootEmUp\bin\x86\Debug\Content\vihollinen4.xnb</Output> 146 <Time>2010-06-17T15:56:12.7345408+03:00</Time> 147 </Item> 121 148 <BuildSuccessful>true</BuildSuccessful> 122 149 <Settings> -
2010/23/hniemi/ShootEmUp/ShootEmUp/Peli.cs
r944 r955 15 15 //Liikkumisnopeudet 16 16 private const double NOPEUS = 300; 17 private const int OLETUSASE = 0; 17 18 private Vector nopeusPysty = new Vector(0,NOPEUS); 18 19 private Vector nopeusVaaka = new Vector(NOPEUS, 0); … … 26 27 private PhysicsObject exitZone; 27 28 29 private GameObject[] tahdet; 30 28 31 //Viholliset 29 private const int VIHOLLISKUVIA = 3;32 private const int VIHOLLISKUVIA = 4; 30 33 31 34 //Statistiikka 32 35 private int kentannro = 0; 33 36 private IntMeter score = new IntMeter(0); 37 private IntMeter lives = new IntMeter(3); 38 private TextDisplay[] aseNimet; 34 39 private Weapon[] weapons; 35 40 36 41 #endregion 37 42 43 /// <summary> 44 /// Aloittaa pelin 45 /// </summary> 38 46 protected override void Begin() 39 47 { 40 48 LataaKentta(kentannro); 49 } 50 51 /// <summary> 52 /// Päivityssilmukka, hoitaa tällä hetkellä manuaalisesti vain 53 /// taustan liikuttamisen 54 /// </summary> 55 /// <param name="time"></param> 56 protected override void Update(Time time) 57 { 58 if (tahdet != null) 59 { 60 for (int i = 0; i < tahdet.Length; i++) 61 { 62 tahdet[i].Y -= 30; 63 if (tahdet[i].Y < Level.Bottom - 40) tahdet[i].Y = Level.Top + 100; 64 } 65 } 66 67 base.Update(time); 41 68 } 42 69 … … 55 82 56 83 Camera.Move(new Vector(250, 0)); 57 84 //Camera.Zoom(0.2); 85 58 86 //Laidat 59 87 LisaData tieto; … … 61 89 tieto.Rajahtaa = true; 62 90 tieto.Damage = 5; 91 92 PhysicsObject[] kulmat = new PhysicsObject[4]; 93 94 for (int i = 0; i < kulmat.Length; i++) 95 { 96 kulmat[i] = PhysicsObject.CreateStaticObject(60, 60); 97 kulmat[i].Image = LoadImage("seina/seinaKulma"); 98 kulmat[i].Tag = tieto; 99 kulmat[i].Angle = Angle.Degrees(i * 90); 100 Add(kulmat[i]); 101 } 102 kulmat[3].Position = new Vector(Level.Left - 30, Level.Top+30); 103 kulmat[2].Position = new Vector(Level.Right + 30, Level.Top + 30); 104 kulmat[0].Position = new Vector(Level.Left - 30, Level.Bottom - 30); 105 kulmat[1].Position = new Vector(Level.Right + 30, Level.Bottom - 30); 106 107 108 //Seinät 109 Level.BackgroundColor = Color.Black; 63 110 vasenLaita = Level.CreateLeftBorder(); 111 vasenLaita.Image = LoadImage("seina/seinaOikea"); 112 vasenLaita.Angle = Angle.Degrees(270); 113 64 114 vasenLaita.Tag = tieto; 65 115 oikeaLaita = Level.CreateRightBorder(); 116 oikeaLaita.Image = LoadImage("seina/seinaOikea"); 117 oikeaLaita.Angle = Angle.Degrees(90); 118 66 119 oikeaLaita.Tag = tieto; 67 120 pohja = Level.CreateBottomBorder(); 121 pohja.Image = LoadImage("seina/seinaOikea"); 122 pohja.Angle = Angle.Degrees(0); 123 pohja.Size = new Vector(pohja.Width - 120, pohja.Height); 124 68 125 pohja.Tag = tieto; 69 126 katto = Level.CreateTopBorder(); 127 katto.Image = LoadImage("seina/seinaOikea"); 128 katto.Angle = Angle.Degrees(180); 129 katto.Size = new Vector(katto.Width - 120, katto.Height); 130 70 131 katto.Tag = tieto; 71 132 … … 74 135 exitZone.Position = new Vector(Level.Center.X, Level.Bottom - exitZone.Size.Y / 2 - 5); 75 136 exitZone.Tag = tieto; 137 exitZone.IsVisible = false; 76 138 Add(exitZone); 77 139 140 78 141 LuoPelaaja(); 142 LataaHUD(); 79 143 LataaKontrollit(pelaajaAlus); 80 //LataaTausta(kentanNumero);144 LataaTausta(kentanNumero); 81 145 LataaViholliset(20, 4,10); 82 LataaHUD();146 83 147 } 84 148 … … 88 152 void LataaHUD() 89 153 { 90 ValueDisplay hpNaytto = new ValueDisplay(); 91 hpNaytto.BindTo(pelaajaAlus.HpMeter); 92 Add(hpNaytto); 93 hpNaytto.Position = new Vector(Level.Right + 40, Level.Top - 80); 94 hpNaytto.Text = "HP: "; 95 96 ValueDisplay scoreNaytto = new ValueDisplay(); 97 scoreNaytto.BindTo(score); 98 Add(scoreNaytto); 99 scoreNaytto.Position = new Vector(Level.Right + 40, Level.Top - 100); 100 scoreNaytto.Text = "SCORE: "; 101 154 ValueDisplay[] naytot = new ValueDisplay[3]; 155 for (int i = 0; i < naytot.Length; i++) 156 { 157 naytot[i] = new ValueDisplay(); 158 Add(naytot[i]); 159 naytot[i].TextColor = Color.White; 160 naytot[i].ValueColor = Color.Yellow; 161 naytot[i].Position = new Vector(Level.Right + 40, Level.Top - 80 - (30*i)); 162 } 163 164 naytot[0].BindTo(pelaajaAlus.HpMeter); 165 naytot[1].BindTo(score); 166 naytot[2].BindTo(lives); 167 naytot[0].Text = "HP: "; 168 naytot[1].Text = "SCORE: "; 169 naytot[2].Text = "LIVES: "; 170 171 aseNimet = new TextDisplay[3]; 172 for (int i = 0; i < aseNimet.Length; i++) 173 { 174 aseNimet[i] = new TextDisplay(); 175 aseNimet[i].TextColor = Color.White; 176 aseNimet[i].Position = new Vector(Level.Right + 40, Level.Top - 200 - (30 * i)); 177 Add(aseNimet[i]); 178 } 179 aseNimet[OLETUSASE].TextColor = Color.Yellow; 180 aseNimet[0].Text = "Beam"; 181 aseNimet[1].Text = "Missile"; 182 aseNimet[2].Text = "Photon"; 183 184 } 185 186 /// <summary> 187 /// Lataa taustalle tähdet 188 /// </summary> 189 /// <param name="kentanNumero"></param> 190 void LataaTausta(int kentanNumero) 191 { 192 tahdet = new GameObject[15]; 193 for (int i = 0; i < tahdet.Length; i++) 194 { 195 GameObject tahti = new GameObject(3, 3); 196 tahti.Color = Color.White; 197 tahti.Position = new Vector(RandomGen.NextDouble(Level.Left, Level.Right), 198 RandomGen.NextDouble(Level.Top +20, Level.Top + 2000)); 199 tahdet[i] = tahti; 200 201 Add(tahti); 202 } 102 203 } 103 204 … … 140 241 for (int i = 0; i < weapons.Length; i++) 141 242 { 243 weapons[i].IsVisible = false; 142 244 pelaajaAlus.Add(weapons[i]); 143 245 } 144 246 145 247 Add(pelaajaAlus); 146 pelaajaAlus.SetWeapon(weapons[ 2]);248 pelaajaAlus.SetWeapon(weapons[OLETUSASE]); 147 249 148 250 AddCollisionHandler(pelaajaAlus, PelaajaTormaa); 149 150 251 } 151 252 … … 193 294 { 194 295 if (aseenNumero > 0 && aseenNumero < 4) 195 pelaajaAlus.SetWeapon(weapons[aseenNumero-1]); 296 { 297 pelaajaAlus.SetWeapon(weapons[aseenNumero-1]); 298 for (int i = 0; i < aseNimet.Length; i++) 299 { 300 aseNimet[i].TextColor = Color.White; 301 } 302 aseNimet[aseenNumero-1].TextColor = Color.Yellow; 303 } 196 304 } 197 305 … … 262 370 Timer ampumaAjastin = new Timer(); 263 371 ampumaAjastin.Interval = 0.7; 264 ampumaAjastin.Trigger += alukset[0]. TimerShoot;372 ampumaAjastin.Trigger += alukset[0].Shoot; 265 373 Add(ampumaAjastin); 266 374 ampumaAjastin.Start(); -
2010/23/hniemi/ShootEmUp/ShootEmUp/ShootEmUp.csproj.Debug.cachefile
r922 r955 12 12 Content\loppuvastus1.xnb 13 13 Content\photon.xnb 14 Content\seina\seinaOikea.xnb 15 Content\seina\seinaKulma.xnb 16 Content\vihollinen4.xnb -
2010/23/hniemi/ShootEmUp/ShootEmUp/Weapons.cs
r932 r955 39 39 this.AddedToGame += LisaaAV; 40 40 this.TimeBetweenUse = (new TimeSpan(0, 0, 0, 0, 5)); 41 41 this.IsVisible = false; 42 42 } 43 43 … … 73 73 projectile.IgnoresCollisionResponse = true; 74 74 SetCollisionHandler(projectile, BeamCollision); 75 ShootProjectile(projectile, 3000 );75 ShootProjectile(projectile, 3000 + (Math.Sin(Game.Time.SinceStartOfGame.Milliseconds) * 100)); 76 76 77 77 return projectile; … … 95 95 Level = 1; 96 96 Damage = 20; 97 this.IsVisible = false; 97 98 this.TimeBetweenUse = (new TimeSpan(0,0,0,0,300)); 98 99 Color = Color.Blue; … … 160 161 Color = Color.Blue; 161 162 this.AddedToGame += LisaaAani; 163 this.IsVisible = false; 162 164 163 165 //Tagi -
2010/23/hniemi/ShootEmUp/ShootEmUp/obj/x86/Debug/ShootEmUp.csproj.FileListAbsolute.txt
r922 r955 34 34 C:\MyTemp\hniemi\ShootEmUp\ShootEmUp\bin\x86\Debug\Content\loppuvastus1.xnb 35 35 C:\MyTemp\hniemi\ShootEmUp\ShootEmUp\bin\x86\Debug\Content\photon.xnb 36 C:\MyTemp\hniemi\ShootEmUp\ShootEmUp\bin\x86\Debug\Content\seina\seinaOikea.xnb 37 C:\MyTemp\hniemi\ShootEmUp\ShootEmUp\bin\x86\Debug\Content\seina\seinaKulma.xnb 38 C:\MyTemp\hniemi\ShootEmUp\ShootEmUp\bin\x86\Debug\Content\vihollinen4.xnb -
2010/23/hniemi/ShootEmUp/ShootEmUp/obj/x86/Debug/cachefile-{72efbe00-2f1f-4e1d-9867-af4a5a7cd89e}-targetpath.txt
r922 r955 12 12 Content\loppuvastus1.xnb 13 13 Content\photon.xnb 14 Content\seina\seinaOikea.xnb 15 Content\seina\seinaKulma.xnb 16 Content\vihollinen4.xnb
Note: See TracChangeset
for help on using the changeset viewer.