- Timestamp:
- 2014-07-22 15:00:38 (9 years ago)
- Location:
- 2014/30/AtteB
- Files:
-
- 15 added
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
2014/30/AtteB/Peli/Peli/Peli/Peli.cs
r5531 r5540 7 7 using Jypeli.Widgets; 8 8 9 class Vihollinen : PhysicsObject 10 { 11 private IntMeter elamaLaskuri = new IntMeter(3, 0, 3); 12 public IntMeter ElamaLaskuri { get { return elamaLaskuri; } } 13 14 public Vihollinen(double leveys, double korkeus) 15 : base(leveys, korkeus) 16 { 17 elamaLaskuri.LowerLimit += delegate { this.Destroy(); }; 18 } 19 } 20 9 21 public class Peli : PhysicsGame 10 22 { 23 int pelaajanTerveys = 100; 24 25 DoubleMeter P1Elämät; 26 11 27 const double nopeus = 200; 12 28 const double hyppyNopeus = 750; … … 14 30 15 31 PlatformCharacter pelaaja1; 16 PlatformCharacter Vihollinen_1; 17 18 Image pelaajanKuva = LoadImage("norsu"); 32 PlatformCharacter vihollinen1; 33 19 34 Image tahtiKuva = LoadImage("tahti"); 20 Image StoneKuva = LoadImage("Stone_brick_tile"); 21 Image StoneTaso = LoadImage("Stone"); 35 Image StoneKuva = LoadImage("StoneWall"); 36 Image StoneTaso = LoadImage("Stone_katto"); 37 Image StoneKuva_katto = LoadImage("Stone_katto"); 38 Image Pelaaja_Seisoo = LoadImage("Pelaaja_Seisoo"); 39 Image Pelaaja_Juoksee = LoadImage("Pelaaja_Juoksee"); 40 Image StoneBrickTaso = LoadImage("Stone_brick_tile"); 41 Image Slime = LoadImage("Slime"); 22 42 23 43 SoundEffect maaliAani = LoadSoundEffect("maali"); … … 26 46 { 27 47 Gravity = new Vector(0, -1000); 48 49 IsMouseVisible = true; 50 SetWindowSize(1000, 800); 28 51 29 52 LuoKentta(); … … 33 56 Camera.ZoomFactor = 1.2; 34 57 Camera.StayInLevel = true; 58 59 SmoothTextures = false; 60 61 P1Elämät= new DoubleMeter(100); 62 P1Elämät.MaxValue = 100; 63 64 BarGauge P1Elämä = new BarGauge(20, Screen.Width / 3); 65 P1Elämä.X = Screen.Left + Screen.Width / 2; 66 P1Elämä.Y = Screen.Top - 200; 67 P1Elämä.Angle = Angle.FromDegrees(90); 68 P1Elämä.BindTo(P1Elämät); 69 P1Elämä.Color = Color.BloodRed; 70 P1Elämä.BarColor = Color.Cyan; 71 Add(P1Elämä); 72 35 73 } 36 74 … … 42 80 kentta.SetTileMethod('N', LisaaPelaaja); 43 81 kentta.SetTileMethod('P', LisaaStoneLattia); 82 kentta.SetTileMethod('+', LisaaStoneKatto); 83 kentta.SetTileMethod('?', LisaaStoneBrickLattia); 84 kentta.SetTileMethod('S', LuoSlime); 44 85 kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 45 86 Level.CreateBorders(); … … 66 107 } 67 108 109 void LisaaStoneBrickLattia(Vector paikka, double leveys, double korkeus) 110 { 111 PhysicsObject stoneBrick = PhysicsObject.CreateStaticObject(leveys, korkeus); 112 stoneBrick.IgnoresCollisionResponse = false; 113 stoneBrick.Position = paikka; 114 stoneBrick.Image = StoneBrickTaso; 115 Add(stoneBrick); 116 117 } 118 119 120 void LisaaStoneKatto(Vector paikka, double leveys, double korkeus) 121 { 122 PhysicsObject Stone = PhysicsObject.CreateStaticObject(leveys, korkeus); 123 Stone.IgnoresCollisionResponse = true; 124 Stone.Position = paikka; 125 Stone.Image = StoneKuva_katto; 126 Add(Stone); 127 128 } 129 130 68 131 void LisaaTahti(Vector paikka, double leveys, double korkeus) 69 132 { … … 81 144 pelaaja1.Position = paikka; 82 145 pelaaja1.Mass = 10.0; 83 pelaaja1.Image = pelaajanKuva;146 pelaaja1.Image = Pelaaja_Seisoo; 84 147 AddCollisionHandler(pelaaja1, "tahti", TormaaTahteen); 85 148 Add(pelaaja1); … … 120 183 tahti.Destroy(); 121 184 } 185 186 void LuoVihollinen(Vector paikka, double leveys, double korkeus) 187 { 188 PhysicsObject vihollinen = new PhysicsObject(leveys, korkeus); 189 vihollinen.Position = paikka; 190 vihollinen.Tag = "pahis"; 191 Add(vihollinen); 192 } 193 194 void LuoHealthPotion(Vector paikka, double leveys, double korkeus) 195 { 196 PhysicsObject potion = new PhysicsObject(leveys, korkeus); 197 potion.Position = paikka; 198 potion.Tag = "health"; 199 Add(potion); 200 } 201 202 void TörmäysKäsittelijät() 203 { 204 AddCollisionHandler(pelaaja1, "pahis", PelaajaOsuu); 205 AddCollisionHandler(pelaaja1, "health", PelaajaParantuu); 206 } 207 208 void PelaajaOsuu(PhysicsObject pelaaja1, PhysicsObject kohde) 209 { 210 pelaajanTerveys--; 211 212 if (pelaajanTerveys <= 0) 213 pelaaja1.Destroy(); 214 } 215 216 void PelaajaParantuu(PhysicsObject pelaaja1, PhysicsObject kohde) 217 { 218 pelaajanTerveys++; 219 } 220 221 void LuoSlime(Vector paikka, double leveys, double korkeus) 222 { 223 Vihollinen Slime1 = new Vihollinen(40, 40); 224 Slime1.X = 20; 225 Slime1.Y = 20; 226 Slime1.Image = Slime; 227 228 } 122 229 } -
2014/30/AtteB/Peli/Peli/Peli/Peli.csproj.Debug.cachefile
r5531 r5540 7 7 Content\Stone_brick_tile.xnb 8 8 Content\Stone.xnb 9 Content\Stone_katto.xnb 10 Content\Pelaaja_seisoo_vasen.xnb 11 Content\Pelaaja_Seisoo.xnb 12 Content\Stonewall.xnb 13 Content\Slime.xnb -
2014/30/AtteB/Peli/Peli/Peli/Properties/AssemblyInfo.cs
r5531 r5540 9 9 [assembly: AssemblyProduct("Peli")] 10 10 [assembly: AssemblyDescription("")] 11 [assembly: AssemblyCompany(" University of Jyvaskyla")]12 [assembly: AssemblyCopyright("Copyright © University of Jyvaskyla 2014")]11 [assembly: AssemblyCompany("AtteB")] 12 [assembly: AssemblyCopyright("Copyright © AtteB")] 13 13 [assembly: AssemblyTrademark("")] 14 14 [assembly: AssemblyCulture("")] -
2014/30/AtteB/Peli/Peli/Peli/obj/x86/Debug/ContentPipeline-{2D86B228-748C-44C7-93B1-DCBD6910317C}.xml
r5531 r5540 36 36 <Options>None</Options> 37 37 <Output>C:\MyTemp\AtteB\Peli\Peli\Peli\bin\x86\Debug\Content\kentta1.xnb</Output> 38 <Time>2014-07-22T1 0:58:11.3529758+03:00</Time>38 <Time>2014-07-22T14:35:50.3392059+03:00</Time> 39 39 </Item> 40 40 <Item> … … 73 73 <Output>C:\MyTemp\AtteB\Peli\Peli\Peli\bin\x86\Debug\Content\Stone.xnb</Output> 74 74 <Time>2014-07-22T10:46:11.0413632+03:00</Time> 75 </Item> 76 <Item> 77 <Source>Stone_katto.png</Source> 78 <Name>Stone_katto</Name> 79 <Importer>TextureImporter</Importer> 80 <Processor>TextureProcessor</Processor> 81 <Options>None</Options> 82 <Output>C:\MyTemp\AtteB\Peli\Peli\Peli\bin\x86\Debug\Content\Stone_katto.xnb</Output> 83 <Time>2014-07-22T13:37:03.1545227+03:00</Time> 84 </Item> 85 <Item> 86 <Source>Pelaaja_seisoo_vasen.png</Source> 87 <Name>Pelaaja_seisoo_vasen</Name> 88 <Importer>TextureImporter</Importer> 89 <Processor>TextureProcessor</Processor> 90 <Options>None</Options> 91 <Output>C:\MyTemp\AtteB\Peli\Peli\Peli\bin\x86\Debug\Content\Pelaaja_seisoo_vasen.xnb</Output> 92 <Time>2014-07-22T13:08:49.0188633+03:00</Time> 93 </Item> 94 <Item> 95 <Source>Pelaaja_Seisoo.png</Source> 96 <Name>Pelaaja_Seisoo</Name> 97 <Importer>TextureImporter</Importer> 98 <Processor>TextureProcessor</Processor> 99 <Options>None</Options> 100 <Output>C:\MyTemp\AtteB\Peli\Peli\Peli\bin\x86\Debug\Content\Pelaaja_Seisoo.xnb</Output> 101 <Time>2014-07-22T13:19:15.0207857+03:00</Time> 102 </Item> 103 <Item> 104 <Source>Stonewall.png</Source> 105 <Name>Stonewall</Name> 106 <Importer>TextureImporter</Importer> 107 <Processor>TextureProcessor</Processor> 108 <Options>None</Options> 109 <Output>C:\MyTemp\AtteB\Peli\Peli\Peli\bin\x86\Debug\Content\Stonewall.xnb</Output> 110 <Time>2014-07-22T13:35:39.5061587+03:00</Time> 111 </Item> 112 <Item> 113 <Source>Slime.png</Source> 114 <Name>Slime</Name> 115 <Importer>TextureImporter</Importer> 116 <Processor>TextureProcessor</Processor> 117 <Options>None</Options> 118 <Output>C:\MyTemp\AtteB\Peli\Peli\Peli\bin\x86\Debug\Content\Slime.xnb</Output> 119 <Time>2014-07-22T14:06:10.9162814+03:00</Time> 75 120 </Item> 76 121 <BuildSuccessful>true</BuildSuccessful> -
2014/30/AtteB/Peli/Peli/Peli/obj/x86/Debug/Peli.csproj.FileListAbsolute.txt
r5531 r5540 15 15 C:\MyTemp\AtteB\Peli\Peli\Peli\bin\x86\Debug\Content\Stone_brick_tile.xnb 16 16 C:\MyTemp\AtteB\Peli\Peli\Peli\bin\x86\Debug\Content\Stone.xnb 17 C:\MyTemp\AtteB\Peli\Peli\Peli\bin\x86\Debug\Content\Stone_katto.xnb 18 C:\MyTemp\AtteB\Peli\Peli\Peli\bin\x86\Debug\Content\Pelaaja_seisoo_vasen.xnb 19 C:\MyTemp\AtteB\Peli\Peli\Peli\bin\x86\Debug\Content\Pelaaja_Seisoo.xnb 20 C:\MyTemp\AtteB\Peli\Peli\Peli\bin\x86\Debug\Content\Stonewall.xnb 21 C:\MyTemp\AtteB\Peli\Peli\Peli\bin\x86\Debug\Content\Slime.xnb -
2014/30/AtteB/Peli/Peli/Peli/obj/x86/Debug/cachefile-{2D86B228-748C-44C7-93B1-DCBD6910317C}-targetpath.txt
r5531 r5540 7 7 Content\Stone_brick_tile.xnb 8 8 Content\Stone.xnb 9 Content\Stone_katto.xnb 10 Content\Pelaaja_seisoo_vasen.xnb 11 Content\Pelaaja_Seisoo.xnb 12 Content\Stonewall.xnb 13 Content\Slime.xnb -
2014/30/AtteB/Peli/Peli/PeliContent/PeliContent.contentproj
r5531 r5540 95 95 </Compile> 96 96 </ItemGroup> 97 <ItemGroup> 98 <Compile Include="Stone_katto.png"> 99 <Name>Stone_katto</Name> 100 <Importer>TextureImporter</Importer> 101 <Processor>TextureProcessor</Processor> 102 </Compile> 103 </ItemGroup> 104 <ItemGroup> 105 <Compile Include="Pelaaja_seisoo_vasen.png"> 106 <Name>Pelaaja_seisoo_vasen</Name> 107 <Importer>TextureImporter</Importer> 108 <Processor>TextureProcessor</Processor> 109 </Compile> 110 </ItemGroup> 111 <ItemGroup> 112 <Compile Include="Pelaaja_Seisoo.png"> 113 <Name>Pelaaja_Seisoo</Name> 114 <Importer>TextureImporter</Importer> 115 <Processor>TextureProcessor</Processor> 116 </Compile> 117 </ItemGroup> 118 <ItemGroup> 119 <Compile Include="Stonewall.png"> 120 <Name>Stonewall</Name> 121 <Importer>TextureImporter</Importer> 122 <Processor>TextureProcessor</Processor> 123 </Compile> 124 </ItemGroup> 125 <ItemGroup> 126 <Compile Include="Slime.png"> 127 <Name>Slime</Name> 128 <Importer>TextureImporter</Importer> 129 <Processor>TextureProcessor</Processor> 130 </Compile> 131 </ItemGroup> 97 132 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 98 133 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2014/30/AtteB/Peli/Peli/PeliContent/kentta1.txt
r5531 r5540 1 ########################################################### 1 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 2 3 3 4 5 6 7 8 9 N V 4 5 N 6 ????? 7 ?????? 8 ???????..............?.....?. 9 ????????.............?..S..?. 10 10 ########################################################### -
2014/30/AtteB/Pong/Pong/Pong/Pong.cs
r5498 r5540 113 113 { 114 114 // Liikuttaa palloa 115 Vector impulssi = new Vector(500.0, 0.0); 115 double palloLiike = RandomGen.NextDouble(500, -500); 116 Vector impulssi = new Vector(palloLiike, 0); 116 117 pallo.Hit(impulssi); 117 118 }
Note: See TracChangeset
for help on using the changeset viewer.