- Timestamp:
- 2014-07-24 15:00:49 (9 years ago)
- Location:
- 2014/30/AkseliK
- Files:
-
- 13 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
2014/30/AkseliK/BunniesVsHunters/BunniesVsHunters/BunniesVsHunters/BunniesVsHunters.cs
r5598 r5643 9 9 public class BunniesVsHunters : PhysicsGame 10 10 { 11 DoubleMeter elamalaskuri; 12 Image taustakuva = LoadImage("puu"); 11 13 const double nopeus = 100; 12 14 const double hyppyNopeus = 450; 13 15 const int RUUDUN_KOKO = 40; 14 16 PlatformCharacter pelaaja1; 17 15 18 16 19 Image pelaajanKuva = LoadImage("thehero"); … … 21 24 Image[] pupuseisoo = LoadImages("janiskavely3"); 22 25 Image luotikuva = LoadImage("luoti"); 26 Image plokkikuva = LoadImage("plokki"); 23 27 SoundEffect maaliAani = LoadSoundEffect("maali"); 28 SoundEffect kuolemisAani = LoadSoundEffect("kuolo"); 24 29 25 30 public override void Begin() … … 29 34 LuoKentta(); 30 35 LisaaNappaimet(); 36 LuoElamaLaskuri(); 31 37 32 38 Camera.Follow(pelaaja1); … … 44 50 kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 45 51 Level.CreateBorders(); 46 Level.Background.CreateGradient(Color.White, Color.SkyBlue); 52 53 //Level.Background.CreateGradient(Color.White, Color.SkyBlue); 54 Level.Background.Image = taustakuva; 55 Level.Background.FitToLevel(); 56 Level.Background.TextureWrapSize = new Vector(10, 1); 57 //Level.Background.ScaleToLevelFull(); 58 //Level.Background.TextureFillsShape = true; 59 //Level.Background.TileToLevel(); 47 60 } 48 61 … … 51 64 PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys, korkeus); 52 65 taso.Position = paikka; 53 taso. Color = Color.Green;66 taso.Image = plokkikuva; 54 67 Add(taso); 55 68 } … … 66 79 void LisaaVihollinen(Vector paikka, double leveys, double korkeus) 67 80 { 68 PlatformCharacter vihollinen = new PlatformCharacter(leveys, korkeus);81 Vihollishahmo vihollinen = new Vihollishahmo (leveys, korkeus, 3, kuolemisAani); 69 82 vihollinen.Position = paikka; 70 83 vihollinen.Image = viholliskuva; … … 76 89 Animation kavelyanimaatio = new Animation(vihollisKavely); 77 90 kavelyanimaatio.FPS = 3; 91 vihollinen.Tag = "vihollinen"; 78 92 vihollinen.AnimWalk = kavelyanimaatio; 93 79 94 80 95 Add(vihollinen); … … 90 105 pelaaja1.AnimWalk.FPS = 4; 91 106 pelaaja1.Weapon = new AssaultRifle(0.1, 0.1); 107 pelaaja1.Weapon.FireRate = 1.5; 108 pelaaja1.Weapon.Power.DefaultValue = 200; 109 pelaaja1.Weapon.AmmoIgnoresGravity = false; 110 pelaaja1.Weapon.ProjectileCollision = AmmusOsui; 92 111 AddCollisionHandler(pelaaja1, "tahti", TormaaTahteen); 112 if( 93 113 94 114 Add(pelaaja1); … … 97 117 { 98 118 PhysicsObject ammus = pelaaja.Weapon.Shoot(); 99 100 119 if (ammus != null) 101 120 { … … 106 125 } 107 126 127 } 128 void AmmusOsui(PhysicsObject ammus, PhysicsObject kohde) 129 { 130 ammus.Destroy(); 131 132 if (kohde.Tag == "vihollinen") 133 { 134 (kohde as Vihollishahmo).ElamaLaskuri.Value--; 135 } 108 136 109 137 } … … 142 170 MessageDisplay.Add("you escaped"); 143 171 tahti.Destroy(); 172 144 173 } 174 void LuoElamaLaskuri() 175 { 176 elamalaskuri = new DoubleMeter(10); 177 elamalaskuri.MaxValue = 10; 178 elamalaskuri.LowerLimit += ElamaLoppui; 179 180 ProgressBar elamaPalkki = new ProgressBar(150, 20); 181 elamaPalkki.X = Screen.Left + 150; 182 elamaPalkki.Y = Screen.Top - 20; 183 elamaPalkki.BindTo(elamalaskuri); 184 Add(elamaPalkki); 185 } 186 187 void ElamaLoppui() 188 { 189 MessageDisplay.Add("u are now lunch"); 190 } 191 145 192 } -
2014/30/AkseliK/BunniesVsHunters/BunniesVsHunters/BunniesVsHunters/BunniesVsHunters.csproj
r5542 r5643 114 114 <Compile Include="BunniesVsHunters.cs" /> 115 115 <Compile Include="Properties\AssemblyInfo.cs" /> 116 <Compile Include="Vihollishahmo.cs" /> 116 117 </ItemGroup> 117 118 <ItemGroup> -
2014/30/AkseliK/BunniesVsHunters/BunniesVsHunters/BunniesVsHunters/BunniesVsHunters.csproj.Debug.cachefile
r5598 r5643 11 11 Content\janiskavely3.xnb 12 12 Content\luoti.xnb 13 Content\puu.xnb 14 Content\kuolo.xnb 15 Content\bloodydeath.xnb 16 Content\plokki.xnb -
2014/30/AkseliK/BunniesVsHunters/BunniesVsHunters/BunniesVsHunters/obj/x86/Debug/BunniesVsHunters.csproj.FileListAbsolute.txt
r5598 r5643 19 19 C:\MyTemp\AkseliK\BunniesVsHunters\BunniesVsHunters\BunniesVsHunters\bin\x86\Debug\Content\janiskavely3.xnb 20 20 C:\MyTemp\AkseliK\BunniesVsHunters\BunniesVsHunters\BunniesVsHunters\bin\x86\Debug\Content\luoti.xnb 21 C:\MyTemp\AkseliK\BunniesVsHunters\BunniesVsHunters\BunniesVsHunters\bin\x86\Debug\Content\puu.xnb 22 C:\MyTemp\AkseliK\BunniesVsHunters\BunniesVsHunters\BunniesVsHunters\bin\x86\Debug\Content\kuolo.xnb 23 C:\MyTemp\AkseliK\BunniesVsHunters\BunniesVsHunters\BunniesVsHunters\bin\x86\Debug\Content\bloodydeath.xnb 24 C:\MyTemp\AkseliK\BunniesVsHunters\BunniesVsHunters\BunniesVsHunters\bin\x86\Debug\Content\plokki.xnb -
2014/30/AkseliK/BunniesVsHunters/BunniesVsHunters/BunniesVsHunters/obj/x86/Debug/ContentPipeline-{B1CC40CE-BF09-4019-9684-652C700666E1}.xml
r5598 r5643 36 36 <Options>None</Options> 37 37 <Output>C:\MyTemp\AkseliK\BunniesVsHunters\BunniesVsHunters\BunniesVsHunters\bin\x86\Debug\Content\kentta1.xnb</Output> 38 <Time>2014-07-2 3T13:59:43.3236753+03:00</Time>38 <Time>2014-07-24T14:48:02.8428651+03:00</Time> 39 39 </Item> 40 40 <Item> … … 110 110 <Time>2014-07-23T14:38:53.1692193+03:00</Time> 111 111 </Item> 112 <Item> 113 <Source>puu.png</Source> 114 <Name>puu</Name> 115 <Importer>TextureImporter</Importer> 116 <Processor>TextureProcessor</Processor> 117 <Options>None</Options> 118 <Output>C:\MyTemp\AkseliK\BunniesVsHunters\BunniesVsHunters\BunniesVsHunters\bin\x86\Debug\Content\puu.xnb</Output> 119 <Time>2014-07-24T10:33:42.4916215+03:00</Time> 120 </Item> 121 <Item> 122 <Source>kuolo.wav</Source> 123 <Name>kuolo</Name> 124 <Importer>WavImporter</Importer> 125 <Processor>SoundEffectProcessor</Processor> 126 <Options>None</Options> 127 <Output>C:\MyTemp\AkseliK\BunniesVsHunters\BunniesVsHunters\BunniesVsHunters\bin\x86\Debug\Content\kuolo.xnb</Output> 128 <Time>2014-07-24T12:53:02.5457561+03:00</Time> 129 </Item> 130 <Item> 131 <Source>bloodydeath.png</Source> 132 <Name>bloodydeath</Name> 133 <Importer>TextureImporter</Importer> 134 <Processor>TextureProcessor</Processor> 135 <Options>None</Options> 136 <Output>C:\MyTemp\AkseliK\BunniesVsHunters\BunniesVsHunters\BunniesVsHunters\bin\x86\Debug\Content\bloodydeath.xnb</Output> 137 <Time>2014-07-24T13:15:38.8535216+03:00</Time> 138 </Item> 139 <Item> 140 <Source>plokki.png</Source> 141 <Name>plokki</Name> 142 <Importer>TextureImporter</Importer> 143 <Processor>TextureProcessor</Processor> 144 <Options>None</Options> 145 <Output>C:\MyTemp\AkseliK\BunniesVsHunters\BunniesVsHunters\BunniesVsHunters\bin\x86\Debug\Content\plokki.xnb</Output> 146 <Time>2014-07-24T14:44:53.9699797+03:00</Time> 147 </Item> 112 148 <BuildSuccessful>true</BuildSuccessful> 113 149 <Settings> -
2014/30/AkseliK/BunniesVsHunters/BunniesVsHunters/BunniesVsHunters/obj/x86/Debug/cachefile-{B1CC40CE-BF09-4019-9684-652C700666E1}-targetpath.txt
r5598 r5643 11 11 Content\janiskavely3.xnb 12 12 Content\luoti.xnb 13 Content\puu.xnb 14 Content\kuolo.xnb 15 Content\bloodydeath.xnb 16 Content\plokki.xnb -
2014/30/AkseliK/BunniesVsHunters/BunniesVsHunters/BunniesVsHuntersContent/BunniesVsHuntersContent.contentproj
r5598 r5643 119 119 </Compile> 120 120 </ItemGroup> 121 <ItemGroup> 122 <Compile Include="puu.png"> 123 <Name>puu</Name> 124 <Importer>TextureImporter</Importer> 125 <Processor>TextureProcessor</Processor> 126 </Compile> 127 </ItemGroup> 128 <ItemGroup> 129 <Compile Include="kuolo.wav"> 130 <Name>kuolo</Name> 131 <Importer>WavImporter</Importer> 132 <Processor>SoundEffectProcessor</Processor> 133 </Compile> 134 </ItemGroup> 135 <ItemGroup> 136 <Compile Include="bloodydeath.png"> 137 <Name>bloodydeath</Name> 138 <Importer>TextureImporter</Importer> 139 <Processor>TextureProcessor</Processor> 140 </Compile> 141 </ItemGroup> 142 <ItemGroup> 143 <Compile Include="plokki.png"> 144 <Name>plokki</Name> 145 <Importer>TextureImporter</Importer> 146 <Processor>TextureProcessor</Processor> 147 </Compile> 148 </ItemGroup> 121 149 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 122 150 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2014/30/AkseliK/BunniesVsHunters/BunniesVsHunters/BunniesVsHuntersContent/kentta1.txt
r5598 r5643 1 1 ................................................................................#######.................... 2 2 ....................................................................####.......#.......#................... 3 . ###.........##..................##########...................,,,.#......#....#.........#.............#######4 ...V.... N...###........####...v........v..........###v.....###.........v.......................v.........*..#5 ###############..#############################################..########################################## ..#3 .............##..................##########...................,,,.#......#....#.........#.............####### 4 ...V.....N..###........####...v........v..........###v.....###.........v.......................v............# 5 ###############..#############################################..##########################################*.#
Note: See TracChangeset
for help on using the changeset viewer.