- Timestamp:
- 2010-08-05 14:57:15 (13 years ago)
- Location:
- 2010/31/hesasnel/Teron seikkailu
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/31/hesasnel/Teron seikkailu/Content/Content.contentproj
r1605 r1626 103 103 </Compile> 104 104 </ItemGroup> 105 <ItemGroup> 106 <Compile Include="multa.png"> 107 <Name>multa</Name> 108 <Importer>TextureImporter</Importer> 109 <Processor>TextureProcessor</Processor> 110 </Compile> 111 </ItemGroup> 112 <ItemGroup> 113 <Compile Include="Ruohikko.png"> 114 <Name>Ruohikko</Name> 115 <Importer>TextureImporter</Importer> 116 <Processor>TextureProcessor</Processor> 117 </Compile> 118 </ItemGroup> 119 <ItemGroup> 120 <Compile Include="Taikajuoma.png"> 121 <Name>Taikajuoma</Name> 122 <Importer>TextureImporter</Importer> 123 <Processor>TextureProcessor</Processor> 124 </Compile> 125 </ItemGroup> 126 <ItemGroup> 127 <Compile Include="Tramppa.png"> 128 <Name>Tramppa</Name> 129 <Importer>TextureImporter</Importer> 130 <Processor>TextureProcessor</Processor> 131 </Compile> 132 </ItemGroup> 133 <ItemGroup> 134 <Compile Include="Ovi.png"> 135 <Name>Ovi</Name> 136 <Importer>TextureImporter</Importer> 137 <Processor>TextureProcessor</Processor> 138 </Compile> 139 </ItemGroup> 140 <ItemGroup> 141 <Compile Include="ropelli pyörii2.png"> 142 <Name>ropelli pyörii2</Name> 143 <Importer>TextureImporter</Importer> 144 <Processor>TextureProcessor</Processor> 145 </Compile> 146 </ItemGroup> 147 <ItemGroup> 148 <Compile Include="ropelli pyörii2 vasen.png"> 149 <Name>ropelli pyörii2 vasen</Name> 150 <Importer>TextureImporter</Importer> 151 <Processor>TextureProcessor</Processor> 152 </Compile> 153 </ItemGroup> 105 154 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 106 155 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2010/31/hesasnel/Teron seikkailu/Peli.cs
r1605 r1626 7 7 class Tasohyppely : PhysicsGame 8 8 { 9 const int ruudunKorkeus = 30; 10 const int ruudunLeveys = 30; 9 11 const double nopeus = 400; 10 12 const double hyppyVoima = 3500; 13 14 Vector normaalipainovoima = new Vector(0, -1000); 15 Vector leijumisvoima = new Vector(0, 50); 11 16 12 17 Image paikallaanVasemmalle = LoadImage("Tero vasen"); … … 14 19 Image[] kavelyVasemmalle = LoadImages("Tero vasen", "Tero 2 vasen"); 15 20 Image[] kavelyOikealle = LoadImages("Tero", "Tero 2"); 16 Image[] hyppy = LoadImages("Tero hyppää"); 21 Image[] hyppyOikealle = LoadImages("Tero hyppää"); 22 Image[] hyppyVasemmalle = LoadImages ("Tero hyppää vasen"); 23 Image[] leijuntaOikealle = LoadImages("ropelli pyörii","ropelli pyörii2"); 24 Image[] leijuntaVasemmalle = LoadImages("ropelli pyörii vasen,ropelli pyörii2 vasen"); 25 Image[] multa = LoadImages("multa"); 26 Image[] ruoho = LoadImages("Ruohikko"); 27 Image[] ovi = LoadImages("Ovi"); 28 Image[] taikajuoma = LoadImages("Taikajuoma"); 29 Image[] tramppa = LoadImages("Tramppa"); 30 31 bool taikajuomakaytossa = false; 32 33 Animation hyppyanim; 34 Animation kavelyanim; 17 35 PlatformCharacter pelaaja1; 18 36 19 37 protected override void Begin() 20 38 { 21 Gravity = new Vector(00000, -1000); 39 Gravity = new Vector(0, -1000); 40 hyppyanim = new Animation(hyppyOikealle); 41 //kavelyanim = new Animation(); 22 42 23 43 luoKentta(); … … 31 51 void luoKentta() 32 52 { 53 TileMap ruudut = TileMap.FromFile("Kenttä1.txt"); 54 ruudut['='] = LuoMulta; 55 ruudut['.'] = LuoRuohikko; 56 ruudut['F'] = LuoTaikajuoma; 57 ruudut['T'] = LuoTramppa; 58 ruudut['M'] = LuoOvi; 59 ruudut.Insert(ruudunLeveys, ruudunKorkeus); 33 60 Level.CreateBorders(); 34 Level.Background.CreateGradient(Color. White, Color.SkyBlue);61 Level.Background.CreateGradient(Color.SkyBlue, Color.SkyBlue); 35 62 36 lisaaTaso(-200, -350);37 lisaaTaso(0, -200);38 63 39 64 lisaaPelaajat(); … … 53 78 pelaaja1 = new PlatformCharacter(70, 100); 54 79 pelaaja1.Mass = 4.0; 55 pelaaja1.KineticFriction = 2.0;80 pelaaja1.KineticFriction = 1.0; 56 81 pelaaja1.Image = LoadImage("Tero"); 82 AddCollisionHandler(pelaaja1, KasittelePelaajanTormays); 83 57 84 pelaaja1.X = 0; 58 85 pelaaja1.Y = Level.Bottom + 120; … … 62 89 pelaaja1.LeftWalkingAnimation = new Animation(kavelyVasemmalle); 63 90 pelaaja1.RightWalkingAnimation = new Animation(kavelyOikealle); 64 pelaaja1.MidAirAnimation = new Animation(hyppy);65 91 66 92 Add(pelaaja1); 93 } 94 95 void KasittelePelaajanTormays(PhysicsObject pelaaja, PhysicsObject kohde) 96 { 97 string tagi = kohde.Tag.ToString(); 98 99 if (tagi == "taikajuoma") 100 { 101 kohde.Destroy(); 102 taikajuomakaytossa = true; 103 104 } 105 if (tagi == "taso") 106 { 107 //Gravity = normaalipainovoima; 108 } 67 109 } 68 110 … … 75 117 Keyboard.Listen(Key.Right, ButtonState.Down, liikuta, "Liikkuu oikealle", pelaaja1, nopeus); 76 118 Keyboard.Listen(Key.Space, ButtonState.Pressed, hyppaa, "Hyppää", pelaaja1, hyppyVoima); 119 Keyboard.Listen(Key.Space, ButtonState.Down, leiju, "Leiju"); 77 120 78 121 ControllerOne.Listen(Button.Back, ButtonState.Pressed, Exit, "Poistu pelistä"); … … 81 124 ControllerOne.Listen(Button.DPadRight, ButtonState.Down, liikuta, "Pelaaja liikkuu oikealle", pelaaja1, nopeus); 82 125 ControllerOne.Listen(Button.A, ButtonState.Pressed, hyppaa, "Pelaaja hyppää", pelaaja1, hyppyVoima); 126 127 } 128 129 void leiju() 130 { 131 if (taikajuomakaytossa) 132 { 133 //Gravity = new Vector(0, -200); 134 pelaaja1.Hit(leijumisvoima); 135 } 83 136 } 84 137 … … 91 144 { 92 145 hahmo.Jump(voima); 146 hahmo.Animation = new Animation(hyppyOikealle); 147 hahmo.Animation.Start(1); 93 148 } 149 PhysicsObject LuoMulta() 150 { 151 PhysicsObject multa = PhysicsObject.CreateStaticObject(31.0,31.0); 152 multa.Image = LoadImage("multa"); 153 return multa; 154 94 155 } 156 PhysicsObject LuoRuohikko() 157 { 158 PhysicsObject Ruohikko = PhysicsObject.CreateStaticObject(31.0, 31.0); 159 Ruohikko.Image = LoadImage("Ruohikko"); 160 Ruohikko.Tag = "taso"; 161 return Ruohikko; 162 } 163 PhysicsObject LuoTaikajuoma() 164 { 165 PhysicsObject Taikajuoma = PhysicsObject.CreateStaticObject(50.0, 80.0); 166 Taikajuoma.Image = LoadImage("Taikajuoma"); 167 Taikajuoma.Tag = "taikajuoma"; 168 return Taikajuoma; 169 } 170 PhysicsObject LuoTramppa() 171 { 172 PhysicsObject Tramppa = PhysicsObject.CreateStaticObject(80.0, 50.0); 173 Tramppa.Image = LoadImage("Tramppa"); 174 return Tramppa; 175 } 176 PhysicsObject LuoOvi() 177 { 178 PhysicsObject Ovi = PhysicsObject.CreateStaticObject(50.0, 100.0); 179 Ovi.Image = LoadImage("Ovi"); 180 return Ovi; 181 } 182 183 protected override void Update(Time time) 184 { 185 //if (pelaaja1.a 186 base.Update(time); 187 } 188 189 } -
2010/31/hesasnel/Teron seikkailu/Teron seikkailu.csproj
r1605 r1626 89 89 <Content Include="Game.ico" /> 90 90 <Content Include="GameThumbnail.png" /> 91 <Content Include="Kenttä1.txt"> 92 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 93 </Content> 91 94 </ItemGroup> 92 95 <ItemGroup>
Note: See TracChangeset
for help on using the changeset viewer.