- Timestamp:
- 2010-07-28 14:52:55 (13 years ago)
- Location:
- 2010/30/mikmatla/NinjaPeli
- Files:
-
- 5 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/30/mikmatla/NinjaPeli/Content/Content.contentproj
r1362 r1372 54 54 </Compile> 55 55 </ItemGroup> 56 <ItemGroup> 57 <Compile Include="Pelaaja Juoksu1.png"> 58 <Name>Pelaaja Juoksu1</Name> 59 <Importer>TextureImporter</Importer> 60 <Processor>TextureProcessor</Processor> 61 </Compile> 62 </ItemGroup> 63 <ItemGroup> 64 <Compile Include="Pelaaja Juoksu2.png"> 65 <Name>Pelaaja Juoksu2</Name> 66 <Importer>TextureImporter</Importer> 67 <Processor>TextureProcessor</Processor> 68 </Compile> 69 </ItemGroup> 70 <ItemGroup> 71 <Compile Include="Pelaaja Juoksu3.png"> 72 <Name>Pelaaja Juoksu3</Name> 73 <Importer>TextureImporter</Importer> 74 <Processor>TextureProcessor</Processor> 75 </Compile> 76 </ItemGroup> 77 <ItemGroup> 78 <Compile Include="Pelaaja Juoksu4.png"> 79 <Name>Pelaaja Juoksu4</Name> 80 <Importer>TextureImporter</Importer> 81 <Processor>TextureProcessor</Processor> 82 </Compile> 83 </ItemGroup> 56 84 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 57 85 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2010/30/mikmatla/NinjaPeli/NinjaPeli.csproj
r1362 r1372 89 89 <Content Include="Game.ico" /> 90 90 <Content Include="GameThumbnail.png" /> 91 <None Include="Kentta1.txt"> 92 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 93 </None> 91 94 </ItemGroup> 92 95 <ItemGroup> -
2010/30/mikmatla/NinjaPeli/Peli.cs
r1362 r1372 10 10 const double hyppyVoima = 4000; 11 11 12 const int ruudunLeveys = 30; 13 const int ruudunKorkeus = 40; 14 12 15 PlatformCharacter pelaaja1; 16 17 Image paikallaanVasemmalle; 18 Image paikallaanOikealle = LoadImage("Pelaaja"); 19 20 Image[] kavelyVasemmalle; 21 Image[] kavelyOikealle = LoadImages("Pelaaja Juoksu1", "Pelaaja Juoksu2", "Pelaaja Juoksu3", "Pelaaja Juoksu4"); 13 22 14 23 protected override void Begin() 15 24 { 16 25 Gravity = new Vector(0, -1200); 26 27 paikallaanVasemmalle = Image.Mirror(paikallaanOikealle); 28 kavelyVasemmalle = Image.Mirror(kavelyOikealle); 17 29 18 30 luoKentta(); … … 22 34 Camera.ZoomFactor = 2.0; 23 35 Camera.StayInLevel = true; 36 24 37 } 25 38 26 39 void luoKentta() 27 40 { 28 Level.CreateBorders();29 41 Level.Background.CreateGradient(Color.White, Color.SkyBlue); 30 42 31 lisaaTaso(-200, -100); 32 lisaaTaso(-200, -250); 43 lisaaPelaajat(); 33 44 34 lisaaPelaajat(); 45 TileMap ruudut = TileMap.FromFile("kentta1.txt"); 46 ruudut['='] = LuoPalikka; 47 ruudut['P'] = LuoPelaaja; 48 ruudut['E'] = LuoExit; 49 ruudut.Insert(ruudunLeveys, ruudunKorkeus); 50 51 } 52 53 PhysicsObject LuoExit() 54 { 55 56 } 57 58 PhysicsObject LuoPelaaja() 59 { 60 PhysicsObject palikka = pelaaja1; 61 return palikka; 62 } 63 64 PhysicsObject LuoPalikka() 65 { 66 PhysicsObject palikka = PhysicsObject.CreateStaticObject(50.0, 50.0); 67 return palikka; 35 68 } 36 69 … … 58 91 pelaaja1.Weapon = pyssy; 59 92 pyssy.BulletCollision = LuotiOsuu; 93 pyssy.Angle += Angle.Degrees(7); 94 95 pelaaja1.LeftIdleAnimation = new Animation(paikallaanVasemmalle); 96 pelaaja1.RightIdleAnimation = new Animation(paikallaanOikealle); 97 98 pelaaja1.LeftWalkingAnimation = new Animation(kavelyVasemmalle); 99 pelaaja1.RightWalkingAnimation = new Animation(kavelyOikealle); 60 100 61 101 } … … 84 124 void LuotiOsuu(PhysicsObject luoti, PhysicsObject toinen) 85 125 { 86 luoti.Destroy(); 87 Explosion rajahdys = new Explosion(40); 88 rajahdys.Position = luoti.Position; 89 Add(rajahdys); 126 if (toinen != pelaaja1) 127 { 128 luoti.Destroy(); 129 Explosion rajahdys = new Explosion(40); 130 rajahdys.Position = luoti.Position; 131 Add(rajahdys); 132 } 90 133 } 91 134
Note: See TracChangeset
for help on using the changeset viewer.