- Timestamp:
- 2016-05-14 13:48:36 (7 years ago)
- Location:
- 2015/koodauskerho/AarreP/Tasohyppelypeli1/Tasohyppelypeli1
- Files:
-
- 6 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/koodauskerho/AarreP/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1.cs
r7149 r7166 16 16 17 17 Image pelaajanKuva = LoadImage("originalhahmo"); 18 Image kukkaKuva = LoadImage("ampujakukka"); 18 19 Image tahtiKuva = LoadImage("sydansydan"); 19 20 Image vihuKuva = LoadImage("originalvihu"); … … 21 22 Image AmpujaKuva = LoadImage("ampujahahmo"); 22 23 Image[] animaatioKuvat = LoadImages("originalhahmo", "hahmosydan","hahmosyosydan"); 23 24 Image ammuttuvihuKuva = LoadImage("ammuttuvihu"); 25 Image ammusKuva = LoadImage("ammushahmo"); 24 26 SoundEffect maaliAani = LoadSoundEffect("maali"); 25 27 26 public override void Begin() 28 29 AssaultRifle pelaajan1Ase; 30 31 //... 32 public override void Begin() 27 33 { 28 34 Gravity = new Vector(0, -1000); … … 46 52 kentta.SetTileMethod('N', LisaaPelaaja); 47 53 kentta.SetTileMethod('v', LisaaVihu); 54 kentta.SetTileMethod('A', LisaaKukka); 48 55 kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 49 56 Level.CreateBorders(); … … 69 76 } 70 77 78 void AmmusOsui(PhysicsObject ammus, PhysicsObject kohde) 79 { 80 ammus.Destroy(); 81 if (kohde.Tag.ToString() == "vihu") 82 { 83 AmpuuVihun(kohde); 84 } 85 } 86 71 87 void LisaaPelaaja(Vector paikka, double leveys, double korkeus) 72 88 { 73 pelaaja1 = new PlatformCharacter( 30, 70);89 pelaaja1 = new PlatformCharacter(50, 70); 74 90 pelaaja1.Position = paikka; 75 91 pelaaja1.Mass = 9.0; … … 77 93 AddCollisionHandler(pelaaja1, "tahti", TormaaTahteen); 78 94 AddCollisionHandler(pelaaja1, "vihu", TormaaVihuun); 79 95 AddCollisionHandler(pelaaja1, "Kukka", TormaaKukkaan); 80 96 Add(pelaaja1); 97 pelaajan1Ase = new AssaultRifle(30, 10); 98 81 99 } 82 100 void LisaaVihu(Vector paikka, double leveys, double korkeus) … … 90 108 } 91 109 110 void LisaaKukka(Vector paikka, double leveys, double korkeus) 111 { 112 PlatformCharacter kukka = new PlatformCharacter(50, 70); 113 kukka.Position = paikka; 114 kukka.Mass = 9.0; 115 kukka.Image = kukkaKuva; 116 kukka.Tag = "Kukka"; 117 Add(kukka); 118 } 119 120 void Tahtaa(AnalogState hiirenLiike) 121 { 122 Vector suunta = (Mouse.PositionOnWorld - pelaajan1Ase.AbsolutePosition).Normalize(); 123 pelaajan1Ase.Angle = suunta.Angle; 124 } 92 125 void LisaaNappaimet() 93 126 { 127 94 128 Keyboard.Listen(Key.F1, ButtonState.Pressed, ShowControlHelp, "Näytä ohjeet"); 95 129 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); … … 98 132 Keyboard.Listen(Key.Right, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja1, nopeus); 99 133 Keyboard.Listen(Key.Up, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", pelaaja1, hyppyNopeus); 100 134 Keyboard.Listen(Key.Space, ButtonState.Down, AmmuAseella, "Ammu", pelaajan1Ase); 101 135 102 136 ControllerOne.Listen(Button.Back, ButtonState.Pressed, Exit, "Poistu pelistä"); … … 129 163 pelaaja1.PlayAnimation(animaatio); 130 164 } 131 void AmpuuVihun(PhysicsObject ampujahahmo, PhysicsObject vihu) 165 166 void AmpuuVihun(PhysicsObject vihu) 132 167 { 133 168 maaliAani.Play(); … … 139 174 pelaaja1.PlayAnimation(animaatio); 140 175 } 176 141 177 void TormaaVihuun(PhysicsObject hahmo, PhysicsObject vihu) 142 178 { … … 150 186 Add(kuva); 151 187 } 188 void TormaaKukkaan(PhysicsObject hahmo, PhysicsObject kukka) 189 { 190 // hahmo.Image = AmpujaKuva; 191 192 //Ammusten määrä aluksi: 193 pelaajan1Ase.Ammo.Value = 1000; 194 195 //Mitä tapahtuu kun ammus osuu johonkin? 196 pelaajan1Ase.ProjectileCollision = AmmusOsui; 197 198 199 pelaaja1.Add(pelaajan1Ase); 200 Mouse.ListenMovement(0.1, Tahtaa, "Tähtää aseella"); 201 } 202 void AmmuAseella(AssaultRifle ase) 203 { 204 PhysicsObject ammus = ase.Shoot(); 205 206 207 208 if (ammus != null) 209 { 210 ammus.Image = ammusKuva; 211 //ammus.Size *= 3; 212 //ammus.Image = ... 213 //ammus.MaximumLifetime = TimeSpan.FromSeconds(2.0); 214 } 215 } 152 216 } -
2015/koodauskerho/AarreP/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1.csproj.Debug.cachefile
r7149 r7166 7 7 Content\hahmosydan.xnb 8 8 Content\vihu.xnb 9 Content\kentta1.xnb10 9 Content\originalvihu.xnb 11 10 Content\kuolema.xnb 11 Content\ampujahahmo.xnb 12 Content\kentta1.xnb 12 13 Content\musa.xnb 13 Content\ampujahahmo.xnb 14 Content\ammushahmo.xnb 15 Content\ampujakukka.xnb 16 Content\ammuttuvihu.xnb 14 17 Content\musa.wma -
2015/koodauskerho/AarreP/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1/obj/x86/Debug/ContentPipeline-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}.xml
r7149 r7166 9 9 <Options>None</Options> 10 10 <Output>C:\MyTemp\AarreP\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\maali.xnb</Output> 11 <Time>2016-0 4-16T10:21:37.100332+03:00</Time>11 <Time>2016-05-14T10:28:09.1908925+03:00</Time> 12 12 </Item> 13 13 <Item> … … 18 18 <Options>None</Options> 19 19 <Output>C:\MyTemp\AarreP\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\norsu.xnb</Output> 20 <Time>2016-0 4-16T10:21:37.163332+03:00</Time>20 <Time>2016-05-14T10:28:09.1908925+03:00</Time> 21 21 </Item> 22 22 <Item> … … 27 27 <Options>None</Options> 28 28 <Output>C:\MyTemp\AarreP\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\tahti.xnb</Output> 29 <Time>2016-0 4-16T10:21:37.245332+03:00</Time>29 <Time>2016-05-14T10:28:09.2064925+03:00</Time> 30 30 </Item> 31 31 <Item> … … 36 36 <Options>None</Options> 37 37 <Output>C:\MyTemp\AarreP\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\sydansydan.xnb</Output> 38 <Time>2016-0 4-16T10:21:37.104332+03:00</Time>38 <Time>2016-05-14T10:28:09.2064925+03:00</Time> 39 39 </Item> 40 40 <Item> … … 45 45 <Options>None</Options> 46 46 <Output>C:\MyTemp\AarreP\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\originalhahmo.xnb</Output> 47 <Time>2016-0 4-16T10:21:37.109332+03:00</Time>47 <Time>2016-05-14T10:28:09.2220925+03:00</Time> 48 48 </Item> 49 49 <Item> … … 54 54 <Options>None</Options> 55 55 <Output>C:\MyTemp\AarreP\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\hahmosyosydan.xnb</Output> 56 <Time>2016-0 4-16T10:21:37.159332+03:00</Time>56 <Time>2016-05-14T10:28:09.2688925+03:00</Time> 57 57 </Item> 58 58 <Item> … … 63 63 <Options>None</Options> 64 64 <Output>C:\MyTemp\AarreP\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\hahmosydan.xnb</Output> 65 <Time>2016-0 4-16T10:21:37.249332+03:00</Time>65 <Time>2016-05-14T10:28:09.3468925+03:00</Time> 66 66 </Item> 67 67 <Item> … … 72 72 <Options>None</Options> 73 73 <Output>C:\MyTemp\AarreP\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\vihu.xnb</Output> 74 <Time>2016-04-16T10:34:25.840332+03:00</Time> 74 <Time>2016-05-14T10:28:09.2064925+03:00</Time> 75 </Item> 76 <Item> 77 <Source>originalvihu.png</Source> 78 <Name>originalvihu</Name> 79 <Importer>TextureImporter</Importer> 80 <Processor>TextureProcessor</Processor> 81 <Options>None</Options> 82 <Output>C:\MyTemp\AarreP\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\originalvihu.xnb</Output> 83 <Time>2016-05-14T10:28:09.1908925+03:00</Time> 84 </Item> 85 <Item> 86 <Source>kuolema.png</Source> 87 <Name>kuolema</Name> 88 <Importer>TextureImporter</Importer> 89 <Processor>TextureProcessor</Processor> 90 <Options>None</Options> 91 <Output>C:\MyTemp\AarreP\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\kuolema.xnb</Output> 92 <Time>2016-05-14T10:28:09.1908925+03:00</Time> 93 </Item> 94 <Item> 95 <Source>ampujahahmo.png</Source> 96 <Name>ampujahahmo</Name> 97 <Importer>TextureImporter</Importer> 98 <Processor>TextureProcessor</Processor> 99 <Options>None</Options> 100 <Output>C:\MyTemp\AarreP\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\ampujahahmo.xnb</Output> 101 <Time>2016-05-14T10:42:23.8362925+03:00</Time> 75 102 </Item> 76 103 <Item> … … 81 108 <Options>None</Options> 82 109 <Output>C:\MyTemp\AarreP\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\kentta1.xnb</Output> 83 <Time>2016-04-16T14:53:21.9058695+03:00</Time> 84 </Item> 85 <Item> 86 <Source>originalvihu.png</Source> 87 <Name>originalvihu</Name> 88 <Importer>TextureImporter</Importer> 89 <Processor>TextureProcessor</Processor> 90 <Options>None</Options> 91 <Output>C:\MyTemp\AarreP\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\originalvihu.xnb</Output> 92 <Time>2016-04-16T10:57:15.116332+03:00</Time> 93 </Item> 94 <Item> 95 <Source>kuolema.png</Source> 96 <Name>kuolema</Name> 97 <Importer>TextureImporter</Importer> 98 <Processor>TextureProcessor</Processor> 99 <Options>None</Options> 100 <Output>C:\MyTemp\AarreP\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\kuolema.xnb</Output> 101 <Time>2016-04-16T12:58:54.8090104+03:00</Time> 110 <Time>2016-05-14T13:42:40.4310215+03:00</Time> 102 111 </Item> 103 112 <Item> … … 109 118 <Output>C:\MyTemp\AarreP\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\musa.xnb</Output> 110 119 <Extra>C:\MyTemp\AarreP\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\musa.wma</Extra> 111 <Time>2016-04-16T14:03:31.5478636+03:00</Time> 112 </Item> 113 <Item> 114 <Source>ampujahahmo.png</Source> 115 <Name>ampujahahmo</Name> 116 <Importer>TextureImporter</Importer> 117 <Processor>TextureProcessor</Processor> 118 <Options>None</Options> 119 <Output>C:\MyTemp\AarreP\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\ampujahahmo.xnb</Output> 120 <Time>2016-04-16T14:33:45.2722179+03:00</Time> 120 <Time>2016-05-14T10:28:09.2064925+03:00</Time> 121 </Item> 122 <Item> 123 <Source>ammushahmo.png</Source> 124 <Name>ammushahmo</Name> 125 <Importer>TextureImporter</Importer> 126 <Processor>TextureProcessor</Processor> 127 <Options>None</Options> 128 <Output>C:\MyTemp\AarreP\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\ammushahmo.xnb</Output> 129 <Time>2016-05-14T10:53:05.6860925+03:00</Time> 130 </Item> 131 <Item> 132 <Source>ampujakukka.png</Source> 133 <Name>ampujakukka</Name> 134 <Importer>TextureImporter</Importer> 135 <Processor>TextureProcessor</Processor> 136 <Options>None</Options> 137 <Output>C:\MyTemp\AarreP\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\ampujakukka.xnb</Output> 138 <Time>2016-05-14T11:14:35.8034925+03:00</Time> 139 </Item> 140 <Item> 141 <Source>ammuttuvihu.png</Source> 142 <Name>ammuttuvihu</Name> 143 <Importer>TextureImporter</Importer> 144 <Processor>TextureProcessor</Processor> 145 <Options>None</Options> 146 <Output>C:\MyTemp\AarreP\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\ammuttuvihu.xnb</Output> 147 <Time>2016-05-14T12:46:28.0843298+03:00</Time> 121 148 </Item> 122 149 <BuildSuccessful>true</BuildSuccessful> … … 167 194 <Assembly> 168 195 <Key>C:\Windows\Microsoft.Net\assembly\GAC_32\Microsoft.Xna.Framework.Content.Pipeline\v4.0_4.0.0.0__842cf8be1de50553\Microsoft.Xna.Framework.Content.Pipeline.dll</Key> 169 <Value>2015-09-16T1 3:26:51.0674639+03:00</Value>196 <Value>2015-09-16T19:26:07.6285999+03:00</Value> 170 197 </Assembly> 171 198 </Assemblies> -
2015/koodauskerho/AarreP/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1/obj/x86/Debug/Tasohyppelypeli1.csproj.FileListAbsolute.txt
r7149 r7166 21 21 C:\MyTemp\AarreP\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\musa.wma 22 22 C:\MyTemp\AarreP\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\ampujahahmo.xnb 23 C:\MyTemp\AarreP\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\ammushahmo.xnb 24 C:\MyTemp\AarreP\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\ampujakukka.xnb 25 C:\MyTemp\AarreP\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\ammuttuvihu.xnb -
2015/koodauskerho/AarreP/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1/obj/x86/Debug/cachefile-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}-targetpath.txt
r7149 r7166 7 7 Content\hahmosydan.xnb 8 8 Content\vihu.xnb 9 Content\kentta1.xnb10 9 Content\originalvihu.xnb 11 10 Content\kuolema.xnb 11 Content\ampujahahmo.xnb 12 Content\kentta1.xnb 12 13 Content\musa.xnb 13 14 Content\musa.wma 14 Content\ampujahahmo.xnb 15 Content\ammushahmo.xnb 16 Content\ampujakukka.xnb 17 Content\ammuttuvihu.xnb -
2015/koodauskerho/AarreP/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1Content/Tasohyppelypeli1Content.contentproj
r7149 r7166 130 130 </Compile> 131 131 </ItemGroup> 132 <ItemGroup> 133 <Compile Include="ammushahmo.png"> 134 <Name>ammushahmo</Name> 135 <Importer>TextureImporter</Importer> 136 <Processor>TextureProcessor</Processor> 137 </Compile> 138 </ItemGroup> 139 <ItemGroup> 140 <Compile Include="ampujakukka.png"> 141 <Name>ampujakukka</Name> 142 <Importer>TextureImporter</Importer> 143 <Processor>TextureProcessor</Processor> 144 </Compile> 145 </ItemGroup> 146 <ItemGroup> 147 <Compile Include="ammuttuvihu.png"> 148 <Name>ammuttuvihu</Name> 149 <Importer>TextureImporter</Importer> 150 <Processor>TextureProcessor</Processor> 151 </Compile> 152 </ItemGroup> 132 153 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 133 154 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2015/koodauskerho/AarreP/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1Content/kentta1.txt
r7149 r7166 1 1 *...................................................................... 2 2 ##..................................................................... 3 ............................... ........................................4 * *..................................... ..............................5 ## N ##.......................................... ........................6 .......................................vvv.......... .....................7 * *................................................ .................3 ...............................########................................ 4 * *.....................................#..##......................... 5 ## N ##..........................................##...................... 6 .......................................vvv..........##................... 7 * *................................................##............... 8 8 ## ## ##............................##.########.......................... 9 .....................................#.............#............ ...........10 * * * * ..................#..............###........ ................9 .....................................#.............#............##......... 10 * * * * ..................#..............###........##.............. 11 11 ## ## ## ##..................#..............#...........#................. 12 12 ..................................#.......##................................. 13 * * * *....................#................... .....................13 * * * *....................#...................A.................... 14 14 ## ## ## ## ## ********* ############################################## 15 15 ............................................................................... 16 .................................v..v..v................................ 17 ######################################################################.......... 16 ............A....................v..v..v................................ 17 ................................................................................ 18 19 20 21 22 23 24 25 26 27 28 29
Note: See TracChangeset
for help on using the changeset viewer.