- Timestamp:
- 2017-06-15 11:38:53 (6 years ago)
- Location:
- 2017/24/MatiasK/SimpleGame
- Files:
-
- 9 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
2017/24/MatiasK/SimpleGame/SimpleGame/SimpleGame/SimpleGame.cs
r8678 r8691 14 14 Image olionKuva = LoadImage("Spaceship"); 15 15 Label Teksti; 16 Timer ajastin; 16 17 17 18 … … 21 22 22 23 Teksti.TextColor = Color.Blue; 23 Teksti.TextScale = new Vector( 5, 5);24 Teksti.TextScale = new Vector(2, 2); 24 25 Teksti.X = 0; 25 26 Teksti.Y = 0; … … 43 44 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Exit"); 44 45 45 Timerajastin = new Timer();46 ajastin = new Timer(); 46 47 ajastin.Interval = 1.5; 47 48 ajastin.Timeout += LisaaVihollisia; 48 ajastin.Start();49 49 50 50 51 Keyboard.Listen(Key.C, ButtonState.Pressed, ShowControlHelp, "Control help menu"); … … 53 54 54 55 MultiSelectWindow alkuValikko = new MultiSelectWindow("Menu", 55 "Start game", " Best Score", "Exit");56 "Start game", "Test flying", "Exit"); 56 57 Add(alkuValikko); 57 58 … … 70 71 pelaajan1Ase = new LaserGun(5, 5); 71 72 72 Mouse.Listen(MouseButton.Left, ButtonState.Down, AmmuAseella, "Shoot", pelaajan1Ase); 73 74 73 Mouse.Listen(MouseButton.Left, ButtonState.Pressed, AmmuAseella, "Shoot", pelaajan1Ase); 74 75 MediaPlayer.IsRepeating = true; 76 77 Grenade kranu = new Grenade(4.0); 78 79 kranu.Explosion.ShockwaveReachesObject += KranaattiOsui; 80 81 kranu.Explosion.AddShockwaveHandler("vihollinen", KranaattiOsui); 82 75 83 76 84 //Ammusten määrä aluksi: … … 84 92 // Mouse.ListenMovement(1.0, ValikossaLiikkuminen, null); 85 93 94 MediaPlayer.Play("pixel_space-G4mMoEkO8gQ_fmt43"); 86 95 87 96 const double NOPEUS = 500; … … 91 100 LiikutaPelaajaa, null, new Vector(NOPEUS, 0)); 92 101 Keyboard.Listen(Key.W, ButtonState.Down, 93 LiikutaPelaajaa, null, new Vector(0, 100));102 LiikutaPelaajaa, null, new Vector(0, 50)); 94 103 Keyboard.Listen(Key.S, ButtonState.Down, 95 LiikutaPelaajaa, null, new Vector(0, - 100));104 LiikutaPelaajaa, null, new Vector(0, -50)); 96 105 Keyboard.Listen(Key.A, ButtonState.Released, 97 106 LiikutaPelaajaa, null, Vector.Zero); … … 102 111 Keyboard.Listen(Key.S, ButtonState.Released, 103 112 LiikutaPelaajaa, null, Vector.Zero); 104 105 106 113 Keyboard.Listen(Key.F, ButtonState.Pressed, Pause, null); 114 Mouse.Listen(MouseButton.Right, ButtonState.Pressed, HeitaKranaatti, "Granade", pelaaja1); 115 Keyboard.Listen(Key.R, ButtonState.Pressed, AloitaAlusta, null); 116 Keyboard.Listen(Key.Space, ButtonState.Pressed, Explode, null); 107 117 108 118 } … … 111 121 { 112 122 pelaaja1.Hit(vektori); 123 } 124 125 void AloitaAlusta() 126 { 127 ClearAll(); 128 Begin(); 129 } 130 131 void Explode() 132 { 133 pelaaja1.Destroy(); 134 int pMaxMaara = 200; 135 // Alustetaan räjähdysjärjestelmä 136 // Parametrit: 137 // * kuva: mitä tekstuuria räjähdyksen 138 // hiukkasten halutaan käyttävän 139 // * pMaxMaara: räjähdyksen käyttämien 140 // hiukkasten eli partikkeleiden maksimimäärä 141 ExplosionSystem rajahdys = 142 new ExplosionSystem(LoadImage("Boom"), pMaxMaara); 143 144 // Lisätään järjestelmä peliin 145 Add(rajahdys); 146 147 rajahdys.AddEffect(pelaaja1.X, pelaaja1.Y, 1); 148 } 149 150 void KranaattiOsui(IPhysicsObject rajahdyksenKohde, Vector v) 151 { 152 rajahdyksenKohde.Destroy(); 153 } 154 155 void HeitaKranaatti(PhysicsObject pelaaja) 156 { 157 Grenade kranu = new Grenade(4.0); 158 pelaaja.Throw(kranu, Angle.FromDegrees(30), 10000); 113 159 } 114 160 … … 137 183 valikonKohdat.Add(kohta1); // Lisätään luotu valikon kohta listaan jossa kohtia säilytetään 138 184 139 Label kohta2 = new Label(" Best Score");185 Label kohta2 = new Label("Test flying"); 140 186 kohta2.Position = new Vector(0, 0); 141 187 valikonKohdat.Add(kohta2); … … 157 203 void StartGame() 158 204 { 205 ajastin.Start(); 159 206 } 160 207 … … 162 209 { 163 210 ammus.Destroy(); 211 if (kohde.Tag.Equals("seina")) return; 212 int pMaxMaara = 200; 213 // Alustetaan räjähdysjärjestelmä 214 // Parametrit: 215 // * kuva: mitä tekstuuria räjähdyksen 216 // hiukkasten halutaan käyttävän 217 // * pMaxMaara: räjähdyksen käyttämien 218 // hiukkasten eli partikkeleiden maksimimäärä 219 ExplosionSystem rajahdys = 220 new ExplosionSystem(LoadImage("Boom"), pMaxMaara); 221 222 // Lisätään järjestelmä peliin 223 Add(rajahdys); 224 225 rajahdys.AddEffect(kohde.X, kohde.Y, 1); 226 164 227 if (kohde == null) return; 165 if (kohde.Tag.Equals("seina")) return;228 166 229 Vihu vihu = (Vihu)kohde; 167 230 vihu.ElamaLaskuri.Value--; … … 185 248 } 186 249 250 251 187 252 void LisaaVihollisia() 188 253 { … … 194 259 vihollinen.Tag = "Vihu"; 195 260 vihollinen.Brain = seuraajanAivot; 261 vihollinen.Shape = Shape.Pentagon; 262 vihollinen.Color = Color.Red; 196 263 Add(vihollinen); 197 264 } … … 222 289 class Vihu : PhysicsObject 223 290 { 224 private IntMeter elamaLaskuri = new IntMeter( 3, 0, 3);291 private IntMeter elamaLaskuri = new IntMeter(5, 0, 5); 225 292 public IntMeter ElamaLaskuri { get { return elamaLaskuri; } } 226 293 -
2017/24/MatiasK/SimpleGame/SimpleGame/SimpleGame/SimpleGame.csproj.Debug.cachefile
r8678 r8691 1 1 Content\Spaceship.xnb 2 Content\SpaceBack.xnb 2 Content\Rajahdys.xnb 3 Content\images.xnb 4 Content\Boom.xnb 5 Content\pixel_space-G4mMoEkO8gQ_fmt43.xnb 6 Content\pixel_space-G4mMoEkO8gQ_fmt43.wma -
2017/24/MatiasK/SimpleGame/SimpleGame/SimpleGame/obj/x86/Debug/ContentPipeline-{5A6F348F-48A2-4571-B9C8-D919CC46F508}.xml
r8678 r8691 10 10 <Output>C:\MyTemp\MatiasK\SimpleGame\SimpleGame\SimpleGame\bin\x86\Debug\Content\Spaceship.xnb</Output> 11 11 <Time>2017-06-14T11:55:26.3677896+03:00</Time> 12 </Item> 13 <Item> 14 <Source>Rajahdys.png</Source> 15 <Name>Rajahdys</Name> 16 <Importer>TextureImporter</Importer> 17 <Processor>TextureProcessor</Processor> 18 <Options>None</Options> 19 <Output>C:\MyTemp\MatiasK\SimpleGame\SimpleGame\SimpleGame\bin\x86\Debug\Content\Rajahdys.xnb</Output> 20 <Time>2017-06-15T10:00:49.5942176+03:00</Time> 21 </Item> 22 <Item> 23 <Source>images.png</Source> 24 <Name>images</Name> 25 <Importer>TextureImporter</Importer> 26 <Processor>TextureProcessor</Processor> 27 <Options>None</Options> 28 <Output>C:\MyTemp\MatiasK\SimpleGame\SimpleGame\SimpleGame\bin\x86\Debug\Content\images.xnb</Output> 29 <Time>2017-06-15T10:17:27.8867359+03:00</Time> 30 </Item> 31 <Item> 32 <Source>Boom.png</Source> 33 <Name>Boom</Name> 34 <Importer>TextureImporter</Importer> 35 <Processor>TextureProcessor</Processor> 36 <Options>None</Options> 37 <Output>C:\MyTemp\MatiasK\SimpleGame\SimpleGame\SimpleGame\bin\x86\Debug\Content\Boom.xnb</Output> 38 <Time>2017-06-15T10:21:21.6554522+03:00</Time> 39 </Item> 40 <Item> 41 <Source>pixel_space-G4mMoEkO8gQ_fmt43.mp3</Source> 42 <Name>pixel_space-G4mMoEkO8gQ_fmt43</Name> 43 <Importer>Mp3Importer</Importer> 44 <Processor>SongProcessor</Processor> 45 <Options>None</Options> 46 <Output>C:\MyTemp\MatiasK\SimpleGame\SimpleGame\SimpleGame\bin\x86\Debug\Content\pixel_space-G4mMoEkO8gQ_fmt43.xnb</Output> 47 <Extra>C:\MyTemp\MatiasK\SimpleGame\SimpleGame\SimpleGame\bin\x86\Debug\Content\pixel_space-G4mMoEkO8gQ_fmt43.wma</Extra> 48 <Time>2017-06-15T10:27:10.3256691+03:00</Time> 12 49 </Item> 13 50 <BuildSuccessful>true</BuildSuccessful> -
2017/24/MatiasK/SimpleGame/SimpleGame/SimpleGame/obj/x86/Debug/SimpleGame.csproj.FileListAbsolute.txt
r8678 r8691 8 8 C:\MyTemp\MatiasK\SimpleGame\SimpleGame\SimpleGame\obj\x86\Debug\SimpleGame.pdb 9 9 C:\MyTemp\MatiasK\SimpleGame\SimpleGame\SimpleGame\bin\x86\Debug\Content\Spaceship.xnb 10 C:\MyTemp\MatiasK\SimpleGame\SimpleGame\SimpleGame\bin\x86\Debug\Content\Rajahdys.xnb 11 C:\MyTemp\MatiasK\SimpleGame\SimpleGame\SimpleGame\bin\x86\Debug\Content\images.xnb 12 C:\MyTemp\MatiasK\SimpleGame\SimpleGame\SimpleGame\bin\x86\Debug\Content\Boom.xnb 13 C:\MyTemp\MatiasK\SimpleGame\SimpleGame\SimpleGame\bin\x86\Debug\Content\pixel_space-G4mMoEkO8gQ_fmt43.xnb 14 C:\MyTemp\MatiasK\SimpleGame\SimpleGame\SimpleGame\bin\x86\Debug\Content\pixel_space-G4mMoEkO8gQ_fmt43.wma -
2017/24/MatiasK/SimpleGame/SimpleGame/SimpleGame/obj/x86/Debug/cachefile-{5A6F348F-48A2-4571-B9C8-D919CC46F508}-targetpath.txt
r8678 r8691 1 1 Content\Spaceship.xnb 2 Content\Rajahdys.xnb 3 Content\images.xnb 4 Content\Boom.xnb 5 Content\pixel_space-G4mMoEkO8gQ_fmt43.xnb 6 Content\pixel_space-G4mMoEkO8gQ_fmt43.wma -
2017/24/MatiasK/SimpleGame/SimpleGame/SimpleGameContent/SimpleGameContent.contentproj
r8678 r8691 52 52 </Compile> 53 53 </ItemGroup> 54 <ItemGroup> 55 <Compile Include="Rajahdys.png"> 56 <Name>Rajahdys</Name> 57 <Importer>TextureImporter</Importer> 58 <Processor>TextureProcessor</Processor> 59 </Compile> 60 </ItemGroup> 61 <ItemGroup> 62 <Compile Include="images.png"> 63 <Name>images</Name> 64 <Importer>TextureImporter</Importer> 65 <Processor>TextureProcessor</Processor> 66 </Compile> 67 </ItemGroup> 68 <ItemGroup> 69 <Compile Include="Boom.png"> 70 <Name>Boom</Name> 71 <Importer>TextureImporter</Importer> 72 <Processor>TextureProcessor</Processor> 73 </Compile> 74 </ItemGroup> 75 <ItemGroup> 76 <Compile Include="pixel_space-G4mMoEkO8gQ_fmt43.mp3"> 77 <Name>pixel_space-G4mMoEkO8gQ_fmt43</Name> 78 <Importer>Mp3Importer</Importer> 79 <Processor>SongProcessor</Processor> 80 </Compile> 81 </ItemGroup> 54 82 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 55 83 <!-- 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.