- Timestamp:
- 2016-06-14 14:59:01 (7 years ago)
- Location:
- 2015/koodauskerho/AarniAR
- Files:
-
- 13 added
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/koodauskerho/AarniAR/GunDown/GunDown/GunDown/GunDown.cs
r7255 r7304 13 13 const int RUUDUN_KOKO = 40; 14 14 15 bool voiTehdaPommin = true; 16 15 17 PlatformCharacter pelaaja1; 16 18 PlasmaCannon pelaajan1Ase; … … 19 21 Image pelaajanKuva = LoadImage("MainChar"); 20 22 Image[] pelaajarunkuva = LoadImages("MainCharRun1", "MainCharRun2"); 23 Image[] crabdemonmoveKuva = LoadImages("CrabDemon1", "CrabDemon2", "CrabDemon3"); 24 Image crabKuva = LoadImage("CrabDemon1"); 21 25 Image tahtiKuva = LoadImage("DiamondGem"); 22 26 Image aseenkuvaOikea = LoadImage("Revolver"); … … 31 35 Image stoneKuva = LoadImage("Stone"); 32 36 Image topKuva = LoadImage("StoneTop"); 37 Image chestKuva = LoadImage("ClosedChest"); 38 Image chestopenKuva = LoadImage("OpenChest"); 33 39 34 40 SoundEffect maaliAani = LoadSoundEffect("maali"); … … 41 47 42 48 LuoKentta(); 49 50 MessageDisplay.Add("You have fallen down. Your story begins here!"); 43 51 44 52 LisaaNappaimet(); … … 58 66 kentta.SetTileMethod('S', LisaaCrackStone); 59 67 kentta.SetTileMethod('T', LisaaStonetop); 68 kentta.SetTileMethod('D', LisaaCrabDemon); 69 kentta.SetTileMethod('C', LisaaChest); 60 70 kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 61 71 Level.CreateBorders(); … … 79 89 void LisaaTahti(Vector paikka, double leveys, double korkeus) 80 90 { 81 PhysicsObject tahti = PhysicsObject.CreateStaticObject(leveys , korkeus);91 PhysicsObject tahti = PhysicsObject.CreateStaticObject(leveys*0.5, korkeus*0.5); 82 92 tahti.IgnoresCollisionResponse = true; 83 93 tahti.Position = paikka; … … 89 99 void LisaaPelaaja(Vector paikka, double leveys, double korkeus) 90 100 { 91 pelaaja1 = new PlatformCharacter(leveys , korkeus);101 pelaaja1 = new PlatformCharacter(leveys * 0.5, korkeus); 92 102 pelaaja1.Position = paikka; 93 103 pelaaja1.Mass = 4.0; … … 98 108 99 109 AddCollisionHandler(pelaaja1, "tahti", TormaaTahteen); 110 AddCollisionHandler(pelaaja1, "vihu", TormaaVihu); 111 AddCollisionHandler(pelaaja1, "Chest", TormaaChest); 100 112 Add(pelaaja1); 101 113 … … 106 118 pelaajan1Ase.X = 3; 107 119 pelaajan1Ase.Y = -3; 108 pelaajan1Ase.ProjectileCollision = AmmusOsui; 120 pelaajan1Ase.ProjectileCollision = Ammusosuuvihuun; 121 122 109 123 110 124 pelaaja1.Add(pelaajan1Ase); … … 121 135 Keyboard.Listen(Key.Space, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", pelaaja1, hyppyNopeus); 122 136 Keyboard.Listen(Key.E, ButtonState.Pressed, AsetaPommi, "Pelaaja asettaa pommin", pelaaja1); 123 Mouse.ListenMovement(0. 1, Tahtaa, "Tähtää aseella");137 Mouse.ListenMovement(0.0, Tahtaa, "Tähtää aseella"); 124 138 Mouse.Listen(MouseButton.Left, ButtonState.Down, AmmuAseella, "Pelaaja Ampuu", pelaajan1Ase); 125 139 … … 148 162 { 149 163 maaliAani.Play(); 150 MessageDisplay.Add("Keräsit tähden!");164 151 165 tahti.Destroy(); 152 166 } … … 168 182 void AmmuAseella(PlasmaCannon ase) 169 183 { 184 if (pelaaja1.IsDestroyed) 185 return; 186 170 187 PhysicsObject ammus = ase.Shoot(); 171 188 //TimeSpan aika = new TimeSpan(0, 0, 2); 172 189 //ammus.MaximumLifetime = aika; 173 190 191 //ammus. += Ammusosuuvihuun; 174 192 175 193 if (ammus != null) … … 177 195 ammus.Size *= 1; 178 196 ammus.Image = bulletKuva; 197 ammus.Tag = "Bullet"; 179 198 ammus.MaximumLifetime = TimeSpan.FromSeconds(0.5); 180 199 } … … 183 202 { 184 203 ammus.Destroy(); 204 205 206 207 185 208 } 186 209 void LisaaCrackStone(Vector paikka, double leveys, double korkeus) … … 200 223 void LisaaPommi() 201 224 { 202 PhysicsObject pommi = new PhysicsObject(20, 20); 203 pommi.Position = pelaaja1.Position; 204 pommi.Image = bombKuva; 205 Add(pommi); 206 Timer.SingleShot(1.0, delegate { rajahda(pommi); }); 225 if (voiTehdaPommin) 226 { 227 voiTehdaPommin = false; 228 PhysicsObject pommi = new PhysicsObject(20, 20); 229 pommi.Position = pelaaja1.Position; 230 pommi.Image = bombKuva; 231 Add(pommi); 232 Timer.SingleShot(1.0, delegate { rajahda(pommi); voiTehdaPommin = true; }); 233 } 207 234 } 208 235 void rajahda(PhysicsObject pommi) … … 239 266 Add(top); 240 267 } 268 void LisaaCrabDemon(Vector paikka, double leveys, double korkeus) 269 { 270 271 Vihu crab = new Vihu(leveys, korkeus * 0.5); 272 crab.AnimWalk = new Animation(crabdemonmoveKuva); 273 crab.AnimWalk.FPS = 5; 274 crab.Mass = 4.0; 275 crab.Position = paikka; 276 crab.Tag = "vihu"; 277 Add(crab); 278 279 PlatformWandererBrain tasoAivot = new PlatformWandererBrain(); 280 tasoAivot.Speed = 100; 281 282 crab.Brain = tasoAivot; 283 } 284 class Vihu : PlatformCharacter 285 { 286 private IntMeter elamaLaskuri = new IntMeter(3, 0, 3); 287 public IntMeter ElamaLaskuri { get { return elamaLaskuri; } } 288 289 public Vihu(double leveys, double korkeus) 290 : base(leveys, korkeus) 291 { 292 elamaLaskuri.LowerLimit += delegate { this.Destroy(); }; 293 } 294 } 295 void TormaaVihu(PhysicsObject Tormaaja, PhysicsObject kohde) 296 { 297 pelaaja1.Destroy(); 298 if (pelaaja1.Weapon != null) 299 pelaaja1.Weapon.Destroy(); 300 MessageDisplay.Add("You Died. Your story ends here..."); 301 } 302 void LisaaChest(Vector paikka, double leveys, double korkeus) 303 { 304 PhysicsObject chest = PhysicsObject.CreateStaticObject(leveys, korkeus); 305 chest.Position = paikka; 306 chest.Image = chestKuva; 307 chest.Tag = "Chest"; 308 Add(chest); 309 } 310 void TormaaChest(PhysicsObject Tormaaja, PhysicsObject kohde) 311 { 312 if (kohde.Image == chestKuva) 313 { 314 315 PhysicsObject diamond = new PhysicsObject(20, 20); 316 diamond.Position = pelaaja1.Position; 317 diamond.Image = tahtiKuva; 318 diamond.Tag = "tahti"; 319 Add(diamond); 320 kohde.Image = chestopenKuva; 321 MessageDisplay.Add("You opened the chest. There was a Diamond inside!"); 322 } 323 } 324 void Ammusosuuvihuun(PhysicsObject Tormaaja, PhysicsObject kohde) 325 { 326 Tormaaja.Destroy(); 327 328 if ((string)kohde.Tag == "vihu") 329 { 330 331 kohde.Destroy(); 332 } 333 334 } 241 335 } -
2015/koodauskerho/AarniAR/GunDown/GunDown/GunDown/GunDown.csproj.Debug.cachefile
r7255 r7304 21 21 Content\Stone.xnb 22 22 Content\Stonetop.xnb 23 Content\CrabDemon1.xnb 24 Content\CrabDemon2.xnb 25 Content\CrabDemon3.xnb 26 Content\ClosedChest.xnb 27 Content\OpenChest.xnb -
2015/koodauskerho/AarniAR/GunDown/GunDown/GunDown/obj/x86/Debug/ContentPipeline-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}.xml
r7255 r7304 54 54 <Options>None</Options> 55 55 <Output>C:\MyTemp\AarniAR\GunDown\GunDown\GunDown\bin\x86\Debug\Content\MainChar.xnb</Output> 56 <Time>2016-06-1 3T09:58:36.8645663+03:00</Time>56 <Time>2016-06-14T09:50:41.4837756+03:00</Time> 57 57 </Item> 58 58 <Item> … … 63 63 <Options>None</Options> 64 64 <Output>C:\MyTemp\AarniAR\GunDown\GunDown\GunDown\bin\x86\Debug\Content\MainCharRun1.xnb</Output> 65 <Time>2016-06-1 3T09:58:37.247371+03:00</Time>65 <Time>2016-06-14T09:51:10.5916861+03:00</Time> 66 66 </Item> 67 67 <Item> … … 72 72 <Options>None</Options> 73 73 <Output>C:\MyTemp\AarniAR\GunDown\GunDown\GunDown\bin\x86\Debug\Content\MainCharRun2.xnb</Output> 74 <Time>2016-06-1 3T09:58:37.2533716+03:00</Time>74 <Time>2016-06-14T09:51:19.4735742+03:00</Time> 75 75 </Item> 76 76 <Item> … … 108 108 <Options>None</Options> 109 109 <Output>C:\MyTemp\AarniAR\GunDown\GunDown\GunDown\bin\x86\Debug\Content\MainCharJump.xnb</Output> 110 <Time>2016-06-1 3T10:11:33.2837045+03:00</Time>110 <Time>2016-06-14T09:50:52.2948566+03:00</Time> 111 111 </Item> 112 112 <Item> … … 117 117 <Options>None</Options> 118 118 <Output>C:\MyTemp\AarniAR\GunDown\GunDown\GunDown\bin\x86\Debug\Content\kentta1.xnb</Output> 119 <Time>2016-06-1 3T14:20:51.6232655+03:00</Time>119 <Time>2016-06-14T13:59:56.9355763+03:00</Time> 120 120 </Item> 121 121 <Item> … … 199 199 <Output>C:\MyTemp\AarniAR\GunDown\GunDown\GunDown\bin\x86\Debug\Content\Stonetop.xnb</Output> 200 200 <Time>2016-06-13T14:07:26.7309077+03:00</Time> 201 </Item> 202 <Item> 203 <Source>CrabDemon1.png</Source> 204 <Name>CrabDemon1</Name> 205 <Importer>TextureImporter</Importer> 206 <Processor>TextureProcessor</Processor> 207 <Options>None</Options> 208 <Output>C:\MyTemp\AarniAR\GunDown\GunDown\GunDown\bin\x86\Debug\Content\CrabDemon1.xnb</Output> 209 <Time>2016-06-14T10:07:29.7817559+03:00</Time> 210 </Item> 211 <Item> 212 <Source>CrabDemon2.png</Source> 213 <Name>CrabDemon2</Name> 214 <Importer>TextureImporter</Importer> 215 <Processor>TextureProcessor</Processor> 216 <Options>None</Options> 217 <Output>C:\MyTemp\AarniAR\GunDown\GunDown\GunDown\bin\x86\Debug\Content\CrabDemon2.xnb</Output> 218 <Time>2016-06-14T10:07:40.3718148+03:00</Time> 219 </Item> 220 <Item> 221 <Source>CrabDemon3.png</Source> 222 <Name>CrabDemon3</Name> 223 <Importer>TextureImporter</Importer> 224 <Processor>TextureProcessor</Processor> 225 <Options>None</Options> 226 <Output>C:\MyTemp\AarniAR\GunDown\GunDown\GunDown\bin\x86\Debug\Content\CrabDemon3.xnb</Output> 227 <Time>2016-06-14T10:07:48.8736649+03:00</Time> 228 </Item> 229 <Item> 230 <Source>ClosedChest.png</Source> 231 <Name>ClosedChest</Name> 232 <Importer>TextureImporter</Importer> 233 <Processor>TextureProcessor</Processor> 234 <Options>None</Options> 235 <Output>C:\MyTemp\AarniAR\GunDown\GunDown\GunDown\bin\x86\Debug\Content\ClosedChest.xnb</Output> 236 <Time>2016-06-14T11:32:28.6461859+03:00</Time> 237 </Item> 238 <Item> 239 <Source>OpenChest.png</Source> 240 <Name>OpenChest</Name> 241 <Importer>TextureImporter</Importer> 242 <Processor>TextureProcessor</Processor> 243 <Options>None</Options> 244 <Output>C:\MyTemp\AarniAR\GunDown\GunDown\GunDown\bin\x86\Debug\Content\OpenChest.xnb</Output> 245 <Time>2016-06-14T11:44:52.081522+03:00</Time> 201 246 </Item> 202 247 <BuildSuccessful>true</BuildSuccessful> -
2015/koodauskerho/AarniAR/GunDown/GunDown/GunDown/obj/x86/Debug/GunDown.csproj.FileListAbsolute.txt
r7255 r7304 29 29 C:\MyTemp\AarniAR\GunDown\GunDown\GunDown\bin\x86\Debug\Content\Stone.xnb 30 30 C:\MyTemp\AarniAR\GunDown\GunDown\GunDown\bin\x86\Debug\Content\Stonetop.xnb 31 C:\MyTemp\AarniAR\GunDown\GunDown\GunDown\bin\x86\Debug\Content\CrabDemon1.xnb 32 C:\MyTemp\AarniAR\GunDown\GunDown\GunDown\bin\x86\Debug\Content\CrabDemon2.xnb 33 C:\MyTemp\AarniAR\GunDown\GunDown\GunDown\bin\x86\Debug\Content\CrabDemon3.xnb 34 C:\MyTemp\AarniAR\GunDown\GunDown\GunDown\bin\x86\Debug\Content\ClosedChest.xnb 35 C:\MyTemp\AarniAR\GunDown\GunDown\GunDown\bin\x86\Debug\Content\OpenChest.xnb -
2015/koodauskerho/AarniAR/GunDown/GunDown/GunDown/obj/x86/Debug/cachefile-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}-targetpath.txt
r7255 r7304 21 21 Content\Stone.xnb 22 22 Content\Stonetop.xnb 23 Content\CrabDemon1.xnb 24 Content\CrabDemon2.xnb 25 Content\CrabDemon3.xnb 26 Content\ClosedChest.xnb 27 Content\OpenChest.xnb -
2015/koodauskerho/AarniAR/GunDown/GunDown/GunDownContent/GunDownContent.contentproj
r7255 r7304 82 82 </ItemGroup> 83 83 <ItemGroup> 84 <Compile Include="GunImageLft.png"> 85 <Name>GunImageLft</Name> 86 <Importer>TextureImporter</Importer> 87 <Processor>TextureProcessor</Processor> 88 </Compile> 89 </ItemGroup> 90 <ItemGroup> 91 <Compile Include="bullet.png"> 92 <Name>bullet</Name> 93 <Importer>TextureImporter</Importer> 94 <Processor>TextureProcessor</Processor> 95 </Compile> 96 </ItemGroup> 97 <ItemGroup> 98 <Compile Include="Box.png"> 99 <Name>Box</Name> 100 <Importer>TextureImporter</Importer> 101 <Processor>TextureProcessor</Processor> 102 </Compile> 103 </ItemGroup> 104 <ItemGroup> 105 <Compile Include="Revolver.png"> 106 <Name>Revolver</Name> 107 <Importer>TextureImporter</Importer> 108 <Processor>TextureProcessor</Processor> 109 </Compile> 110 </ItemGroup> 111 <ItemGroup> 112 <Compile Include="RevBullet.png"> 113 <Name>RevBullet</Name> 114 <Importer>TextureImporter</Importer> 115 <Processor>TextureProcessor</Processor> 116 </Compile> 117 </ItemGroup> 118 <ItemGroup> 119 <Compile Include="RevolverLft.png"> 120 <Name>RevolverLft</Name> 121 <Importer>TextureImporter</Importer> 122 <Processor>TextureProcessor</Processor> 123 </Compile> 124 </ItemGroup> 125 <ItemGroup> 126 <Compile Include="DiamondGem.png"> 127 <Name>DiamondGem</Name> 128 <Importer>TextureImporter</Importer> 129 <Processor>TextureProcessor</Processor> 130 </Compile> 131 </ItemGroup> 132 <ItemGroup> 133 <Compile Include="Bomb.png"> 134 <Name>Bomb</Name> 135 <Importer>TextureImporter</Importer> 136 <Processor>TextureProcessor</Processor> 137 </Compile> 138 </ItemGroup> 139 <ItemGroup> 140 <Compile Include="CrackedStone.png"> 141 <Name>CrackedStone</Name> 142 <Importer>TextureImporter</Importer> 143 <Processor>TextureProcessor</Processor> 144 </Compile> 145 </ItemGroup> 146 <ItemGroup> 147 <Compile Include="CaveExit.png"> 148 <Name>CaveExit</Name> 149 <Importer>TextureImporter</Importer> 150 <Processor>TextureProcessor</Processor> 151 </Compile> 152 </ItemGroup> 153 <ItemGroup> 154 <Compile Include="Stone.png"> 155 <Name>Stone</Name> 156 <Importer>TextureImporter</Importer> 157 <Processor>TextureProcessor</Processor> 158 </Compile> 159 </ItemGroup> 160 <ItemGroup> 161 <Compile Include="Stonetop.png"> 162 <Name>Stonetop</Name> 163 <Importer>TextureImporter</Importer> 164 <Processor>TextureProcessor</Processor> 165 </Compile> 166 </ItemGroup> 167 <ItemGroup> 84 168 <Compile Include="MainChar.png"> 85 169 <Name>MainChar</Name> … … 89 173 </ItemGroup> 90 174 <ItemGroup> 175 <Compile Include="MainCharJump.png"> 176 <Name>MainCharJump</Name> 177 <Importer>TextureImporter</Importer> 178 <Processor>TextureProcessor</Processor> 179 </Compile> 180 </ItemGroup> 181 <ItemGroup> 91 182 <Compile Include="MainCharRun1.png"> 92 183 <Name>MainCharRun1</Name> … … 103 194 </ItemGroup> 104 195 <ItemGroup> 105 <Compile Include="GunImageLft.png"> 106 <Name>GunImageLft</Name> 107 <Importer>TextureImporter</Importer> 108 <Processor>TextureProcessor</Processor> 109 </Compile> 110 </ItemGroup> 111 <ItemGroup> 112 <Compile Include="bullet.png"> 113 <Name>bullet</Name> 114 <Importer>TextureImporter</Importer> 115 <Processor>TextureProcessor</Processor> 116 </Compile> 117 </ItemGroup> 118 <ItemGroup> 119 <Compile Include="Box.png"> 120 <Name>Box</Name> 121 <Importer>TextureImporter</Importer> 122 <Processor>TextureProcessor</Processor> 123 </Compile> 124 </ItemGroup> 125 <ItemGroup> 126 <Compile Include="MainCharJump.png"> 127 <Name>MainCharJump</Name> 128 <Importer>TextureImporter</Importer> 129 <Processor>TextureProcessor</Processor> 130 </Compile> 131 </ItemGroup> 132 <ItemGroup> 133 <Compile Include="Revolver.png"> 134 <Name>Revolver</Name> 135 <Importer>TextureImporter</Importer> 136 <Processor>TextureProcessor</Processor> 137 </Compile> 138 </ItemGroup> 139 <ItemGroup> 140 <Compile Include="RevBullet.png"> 141 <Name>RevBullet</Name> 142 <Importer>TextureImporter</Importer> 143 <Processor>TextureProcessor</Processor> 144 </Compile> 145 </ItemGroup> 146 <ItemGroup> 147 <Compile Include="RevolverLft.png"> 148 <Name>RevolverLft</Name> 149 <Importer>TextureImporter</Importer> 150 <Processor>TextureProcessor</Processor> 151 </Compile> 152 </ItemGroup> 153 <ItemGroup> 154 <Compile Include="DiamondGem.png"> 155 <Name>DiamondGem</Name> 156 <Importer>TextureImporter</Importer> 157 <Processor>TextureProcessor</Processor> 158 </Compile> 159 </ItemGroup> 160 <ItemGroup> 161 <Compile Include="Bomb.png"> 162 <Name>Bomb</Name> 163 <Importer>TextureImporter</Importer> 164 <Processor>TextureProcessor</Processor> 165 </Compile> 166 </ItemGroup> 167 <ItemGroup> 168 <Compile Include="CrackedStone.png"> 169 <Name>CrackedStone</Name> 170 <Importer>TextureImporter</Importer> 171 <Processor>TextureProcessor</Processor> 172 </Compile> 173 </ItemGroup> 174 <ItemGroup> 175 <Compile Include="CaveExit.png"> 176 <Name>CaveExit</Name> 177 <Importer>TextureImporter</Importer> 178 <Processor>TextureProcessor</Processor> 179 </Compile> 180 </ItemGroup> 181 <ItemGroup> 182 <Compile Include="Stone.png"> 183 <Name>Stone</Name> 184 <Importer>TextureImporter</Importer> 185 <Processor>TextureProcessor</Processor> 186 </Compile> 187 </ItemGroup> 188 <ItemGroup> 189 <Compile Include="Stonetop.png"> 190 <Name>Stonetop</Name> 196 <Compile Include="CrabDemon1.png"> 197 <Name>CrabDemon1</Name> 198 <Importer>TextureImporter</Importer> 199 <Processor>TextureProcessor</Processor> 200 </Compile> 201 </ItemGroup> 202 <ItemGroup> 203 <Compile Include="CrabDemon2.png"> 204 <Name>CrabDemon2</Name> 205 <Importer>TextureImporter</Importer> 206 <Processor>TextureProcessor</Processor> 207 </Compile> 208 </ItemGroup> 209 <ItemGroup> 210 <Compile Include="CrabDemon3.png"> 211 <Name>CrabDemon3</Name> 212 <Importer>TextureImporter</Importer> 213 <Processor>TextureProcessor</Processor> 214 </Compile> 215 </ItemGroup> 216 <ItemGroup> 217 <Compile Include="ClosedChest.png"> 218 <Name>ClosedChest</Name> 219 <Importer>TextureImporter</Importer> 220 <Processor>TextureProcessor</Processor> 221 </Compile> 222 </ItemGroup> 223 <ItemGroup> 224 <Compile Include="OpenChest.png"> 225 <Name>OpenChest</Name> 191 226 <Importer>TextureImporter</Importer> 192 227 <Processor>TextureProcessor</Processor> -
2015/koodauskerho/AarniAR/GunDown/GunDown/GunDownContent/kentta1.txt
r7255 r7304 1 #################################################### 2 # # 3 # E # 4 #TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT # 5 # # #TT # 6 # # # T# 7 # S S ## 8 ## * S TT TT TT S T## 9 ### TT #TTT TTT#TTTT### 10 #### ######## 11 ##### TTTTT ######## 12 ###### ######## 13 ####### TT ######## 14 # TT ######## 15 # N ## ######## 16 #TTTTTTTTTTTTTTTTTTTTTTTT##TTTTTTTTTTTTTTTTT######## 17 #################################################### 18 #################################################### 1 # ############################################################ 2 # N ########### ########################## # 3 # ########### ########################## # 4 # ########### T ########################## E # 5 # ########### #################################### T# 6 # ###########T T################################## ## 7 # # # ## 8 # # # T## 9 # # TTT ### 10 # D ### 11 # TTTTT TTTTTTTTTTTTTTT### 12 # T S ########### 13 # # D D D S C ########### 14 #TTTTTTTTTT#TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT################## 15 ################################################################## 16 ################################################################## 17 ################################################################## 18 ################################################################## 19 ##################################################################
Note: See TracChangeset
for help on using the changeset viewer.