- Timestamp:
- 2016-07-29 11:39:58 (7 years ago)
- Location:
- 2016/30/JuhaniP
- Files:
-
- 21 added
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
2016/30/JuhaniP/Gunjump/Gunjump/Gunjump/Gunjump.cs
r8123 r8246 12 12 const double hyppyNopeus = 750; 13 13 const int RUUDUN_KOKO = 40; 14 15 14 PlatformCharacter pelaaja1; 16 15 PhysicsObject vihollinen; 17 16 Image pelaajanKuva = LoadImage("norsu"); 18 17 Image tahtiKuva = LoadImage("tahti"); 19 18 Image mutantman = LoadImage("mutantman"); 20 19 SoundEffect maaliAani = LoadSoundEffect("maali"); 21 20 Image ovenkuva = LoadImage("ruskeaovi"); 22 21 public override void Begin() 23 22 { 23 Aloitapeli(); 24 25 } 26 void Aloitapeli() 27 { 28 ClearAll(); 24 29 Gravity = new Vector(0, -1000); 25 26 30 LuoKentta(); 27 31 LisaaNappaimet(); 28 29 32 Camera.Follow(pelaaja1); 30 33 Camera.ZoomFactor = 1.2; 31 34 Camera.StayInLevel = true; 32 35 } 33 34 36 void LuoKentta() 35 37 { 36 38 TileMap kentta = TileMap.FromLevelAsset("kentta1"); 37 39 kentta.SetTileMethod('#', LisaaTaso); 40 kentta.SetTileMethod('N', LisaaPelaaja); 38 41 kentta.SetTileMethod('*', LisaaTahti); 39 kentta.SetTileMethod('N', LisaaPelaaja); 42 kentta.SetTileMethod('V', LisaaVihollinen); 43 kentta.SetTileMethod('L', Lisaaovi); 44 40 45 kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 41 46 Level.CreateBorders(); … … 61 66 } 62 67 68 69 // Aliohjelma joka ajetaan kun olio on tarpeeksi lähellä kohdetta. 70 void mitaTapahtuuKunOllaanLahella(AssaultRifle vihollisenase) 71 { 72 VihollinenAmmuPyssylla(vihollisenase); 73 74 75 } 63 76 void LisaaPelaaja(Vector paikka, double leveys, double korkeus) 77 64 78 { 65 79 pelaaja1 = new PlatformCharacter(leveys, korkeus); 66 80 pelaaja1.Position = paikka; 81 pelaaja1.Tag = "soturi"; 67 82 pelaaja1.Mass = 4.0; 68 83 pelaaja1.Image = pelaajanKuva; 69 84 AddCollisionHandler(pelaaja1, "tahti", TormaaTahteen); 85 AddCollisionHandler(pelaaja1, "voitto", TormaaOveen); 70 86 Add(pelaaja1); 71 87 pelaaja1.Weapon = new AssaultRifle(30, 10); 72 88 89 } 90 void LisaaVihollinen(Vector paikka, double leveys, double korkeus) 91 { 92 93 vihollinen = new PhysicsObject(leveys, korkeus); 94 vihollinen.Image = mutantman; 95 vihollinen.Tag = "mutantman"; 96 vihollinen.Position = paikka; 97 vihollinen.CanRotate = false; 98 // RandomMoverBrain satunnaisAivot = new RandomMoverBrain(200); 99 Add(vihollinen); 100 AssaultRifle vihollisenase = new AssaultRifle(40, 40); 101 vihollisenase.FireRate = 5.0; 102 vihollisenase.ProjectileCollision = ammusosuu; 103 104 vihollinen.Add(vihollisenase); 105 FollowerBrain seuraajanAivot = new FollowerBrain("soturi"); 106 107 seuraajanAivot.Active = true; 108 seuraajanAivot.Speed = 300; // Millä nopeudella kohdetta seurataan 109 seuraajanAivot.DistanceFar = 600; // Etäisyys jolla aletaan seurata kohdetta 110 seuraajanAivot.DistanceClose = 200; // Etäisyys jolloin ollaan lähellä kohdetta 111 seuraajanAivot.StopWhenTargetClose = true; // Pysähdytään kun ollaan lähellä kohdetta 112 //seuraajanAivot.FarBrain = satunnaisAivot; // Käytetään satunnaisaivoja kun ollaan kaukana 113 seuraajanAivot.TargetClose += delegate { mitaTapahtuuKunOllaanLahella(vihollisenase); }; 114 115 vihollinen.Brain = seuraajanAivot; 116 vihollinen.Brain.Active = true; 73 117 } 74 118 … … 83 127 84 128 ControllerOne.Listen(Button.Back, ButtonState.Pressed, Exit, "Poistu pelistä"); 85 129 Keyboard.Listen(Key.Space, ButtonState.Down, PelaajaAmmuAseella, "Ammu", pelaaja1); 86 130 ControllerOne.Listen(Button.DPadLeft, ButtonState.Down, Liikuta, "Pelaaja liikkuu vasemmalle", pelaaja1, -nopeus); 87 131 ControllerOne.Listen(Button.DPadRight, ButtonState.Down, Liikuta, "Pelaaja liikkuu oikealle", pelaaja1, nopeus); … … 107 151 tahti.Destroy(); 108 152 } 109 } 110 void AmmuAseella(PlatformCharacter pelaaja) 111 { 112 PhysicsObject ammus = pelaaja.Weapon.Shoot(); 113 114 if (ammus != null) 115 { 116 //ammus.Size *= 3; 117 //ammus.Image = ... 118 //ammus.MaximumLifetime = TimeSpan.FromSeconds(2.0); 119 } 120 { 153 154 void PelaajaAmmuAseella(PlatformCharacter pelaaja) 155 156 { 157 PhysicsObject ammus = pelaaja.Weapon.Shoot(); 158 159 if (ammus != null) 160 { 161 AddCollisionHandler(ammus, "mutantman", ammusosuu); 162 //ammus.Size *= 3; 163 //ammus.Image = ... 164 ammus.MaximumLifetime = TimeSpan.FromSeconds(1.0); 165 } 166 167 } 168 //ammus.Destroy(); 169 void ammusosuu(PhysicsObject ammus, PhysicsObject kohde) 170 { 171 172 kohde.Destroy(); 173 } 174 175 void VihollinenAmmuPyssylla(AssaultRifle ase) 176 177 { 178 PhysicsObject ammus = ase.Shoot(); 179 180 if (ammus != null) 181 { 182 MessageDisplay.Add("Pumpam"); 183 AddCollisionHandler(ammus, "soturi", ammusosuu); 184 //ammus.Size *= 3; 185 //ammus.Image = ... 186 ammus.MaximumLifetime = TimeSpan.FromSeconds(1.0); 187 } 188 189 } 190 191 void Lisaaovi(Vector paikka,double leveys,double korkeus) 192 { 193 PhysicsObject ovi = new PhysicsObject(leveys, korkeus); 194 ovi.Shape = Shape.Rectangle; 195 ovi.Position = paikka; 196 ovi.Image = ovenkuva; 197 ovi.Tag = "voitto"; 198 Add(ovi); 199 200 } 201 void TormaaOveen(PhysicsObject pelaaja, PhysicsObject ovi) 202 { 203 Aloitapeli(); 204 205 } 206 207 } 208 209 -
2016/30/JuhaniP/Gunjump/Gunjump/Gunjump/Gunjump.csproj.Debug.cachefile
r8123 r8246 3 3 Content\tahti.xnb 4 4 Content\kentta1.xnb 5 Content\mutantman.xnb 6 Content\ruskeaovi.xnb 7 Content\hyppy.xnb 8 Content\laukaus.xnb 9 Content\piste.xnb 10 Content\voitto.xnb 11 Content\mutantman.png -
2016/30/JuhaniP/Gunjump/Gunjump/Gunjump/obj/x86/Debug/ContentPipeline-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}.xml
r8123 r8246 18 18 <Options>None</Options> 19 19 <Output>C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\norsu.xnb</Output> 20 <Time>2016-07-2 6T14:24:47.4111271+03:00</Time>20 <Time>2016-07-27T13:38:50.6191471+03:00</Time> 21 21 </Item> 22 22 <Item> … … 36 36 <Options>None</Options> 37 37 <Output>C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\kentta1.xnb</Output> 38 <Time>2016-07-26T14:49:02.1923271+03:00</Time> 38 <Time>2016-07-29T11:22:46.3154486+03:00</Time> 39 </Item> 40 <Item> 41 <Source>mutantman.png</Source> 42 <Name>mutantman</Name> 43 <Importer>TextureImporter</Importer> 44 <Processor>TextureProcessor</Processor> 45 <Options>None</Options> 46 <Output>C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\mutantman.xnb</Output> 47 <Time>2016-07-27T13:07:23.9907471+03:00</Time> 48 </Item> 49 <Item> 50 <Source>ruskeaovi.png</Source> 51 <Name>ruskeaovi</Name> 52 <Importer>TextureImporter</Importer> 53 <Processor>TextureProcessor</Processor> 54 <Options>None</Options> 55 <Output>C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\ruskeaovi.xnb</Output> 56 <Time>2016-07-28T14:31:34.9357777+03:00</Time> 57 </Item> 58 <Item> 59 <Source>hyppy.wav</Source> 60 <Name>hyppy</Name> 61 <Importer>WavImporter</Importer> 62 <Processor>SoundEffectProcessor</Processor> 63 <Options>None</Options> 64 <Output>C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\hyppy.xnb</Output> 65 <Time>2016-07-29T10:30:05.4666486+03:00</Time> 66 </Item> 67 <Item> 68 <Source>laukaus.wav</Source> 69 <Name>laukaus</Name> 70 <Importer>WavImporter</Importer> 71 <Processor>SoundEffectProcessor</Processor> 72 <Options>None</Options> 73 <Output>C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\laukaus.xnb</Output> 74 <Time>2016-07-29T10:30:05.4666486+03:00</Time> 75 </Item> 76 <Item> 77 <Source>piste.wav</Source> 78 <Name>piste</Name> 79 <Importer>WavImporter</Importer> 80 <Processor>SoundEffectProcessor</Processor> 81 <Options>None</Options> 82 <Output>C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\piste.xnb</Output> 83 <Time>2016-07-29T10:30:05.4666486+03:00</Time> 84 </Item> 85 <Item> 86 <Source>voitto.wav</Source> 87 <Name>voitto</Name> 88 <Importer>WavImporter</Importer> 89 <Processor>SoundEffectProcessor</Processor> 90 <Options>None</Options> 91 <Output>C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\voitto.xnb</Output> 92 <Time>2016-07-29T10:30:05.4666486+03:00</Time> 39 93 </Item> 40 94 <BuildSuccessful>true</BuildSuccessful> -
2016/30/JuhaniP/Gunjump/Gunjump/Gunjump/obj/x86/Debug/Gunjump.csproj.FileListAbsolute.txt
r8123 r8246 11 11 C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\obj\x86\Debug\Gunjump.exe 12 12 C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\obj\x86\Debug\Gunjump.pdb 13 C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\mutantman.xnb 14 C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\mutantman.png 15 C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\ruskeaovi.xnb 16 C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\hyppy.xnb 17 C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\laukaus.xnb 18 C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\piste.xnb 19 C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\voitto.xnb -
2016/30/JuhaniP/Gunjump/Gunjump/Gunjump/obj/x86/Debug/cachefile-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}-targetpath.txt
r8123 r8246 3 3 Content\tahti.xnb 4 4 Content\kentta1.xnb 5 Content\mutantman.xnb 6 Content\ruskeaovi.xnb 7 Content\hyppy.xnb 8 Content\laukaus.xnb 9 Content\piste.xnb 10 Content\voitto.xnb 11 Content\mutantman.png -
2016/30/JuhaniP/Gunjump/Gunjump/GunjumpContent/GunjumpContent.contentproj
r8123 r8246 67 67 </Compile> 68 68 </ItemGroup> 69 <ItemGroup> 70 <Compile Include="mutantman.png"> 71 <Name>mutantman</Name> 72 <Importer>TextureImporter</Importer> 73 <Processor>TextureProcessor</Processor> 74 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 75 </Compile> 76 </ItemGroup> 77 <ItemGroup> 78 <Compile Include="ruskeaovi.png"> 79 <Name>ruskeaovi</Name> 80 <Importer>TextureImporter</Importer> 81 <Processor>TextureProcessor</Processor> 82 </Compile> 83 </ItemGroup> 84 <ItemGroup> 85 <Compile Include="hyppy.wav"> 86 <Name>hyppy</Name> 87 <Importer>WavImporter</Importer> 88 <Processor>SoundEffectProcessor</Processor> 89 </Compile> 90 <Compile Include="laukaus.wav"> 91 <Name>laukaus</Name> 92 <Importer>WavImporter</Importer> 93 <Processor>SoundEffectProcessor</Processor> 94 </Compile> 95 <Compile Include="piste.wav"> 96 <Name>piste</Name> 97 <Importer>WavImporter</Importer> 98 <Processor>SoundEffectProcessor</Processor> 99 </Compile> 100 <Compile Include="voitto.wav"> 101 <Name>voitto</Name> 102 <Importer>WavImporter</Importer> 103 <Processor>SoundEffectProcessor</Processor> 104 </Compile> 105 </ItemGroup> 69 106 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 70 107 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2016/30/JuhaniP/Gunjump/Gunjump/GunjumpContent/kentta1.txt
r8123 r8246 1 *2 3 4 **1 VVVVVVVVVVVVVV VVVVV V VVV L 2 V ############################################### ################# ###################### ################# 3 #### 4 # *V * 5 5 ## ## 6 6 7 7 * * 8 ## ## ## 9 10 * * * * 11 ## ## ## ## 12 13 * * * * 14 ## ## ## ## ## 15 16 17 ###################### 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 ## 39 ####################### ## 40 ## 41 ## 42 ******************** ### 43 ##################### 44 ## ## ## 45 ***************** ## ## ## 8 ## ## ##VVVVVVVVV 9 #### VVVVVVV 10 VVVVVVVVVVV ## # # # # # # # # # # # # # # # # # 11 ###################### # 12 # 13 # V V VV V V V 14 # # # # # # # # # # # # # # # # # # # # # # 15 #################### 16 #### 17 ******************##*************VVVVVVVVVVVVVVVVVVV*** # 18 ########################################################################################################### ########################## 19 # ### 20 ##### ## # # # # # # # # # # # # # # # # # # # # # # # # ## # # # # # # #### 21 ## ## ## ### 22 ######## ## # ### 23 VVVVVVVVVV##VVVVV ## ####### 24 ################################################################################# ## ## 25 ### # # # # # # # # # ## ... . # V VV V # V 26 # ## # # # # # 27 ## # # ####### ## 28 ## # # # # # # # # 29 # # # # V # V ## ## 30 ## ################ # # # # ## ## ## 31 ## # # # # ## ## ## 32 ## # ## ## 33 ******************** ### ## ## ############### # 34 ##################### 35 ## ## 36 ***************** ## ## ## 46 37 #################### ## ## 47 38 48 39 ##### ## ## 49 ###### 50 ## ##51 N*************************************************************************************************' ##40 ###### 41 ## ## ## 42 V N*******************************************VVVVV**************************************************##****' ## 52 43 ###################################################################################################################################################
Note: See TracChangeset
for help on using the changeset viewer.