Changeset 3808
- Timestamp:
- 2012-07-27 12:30:08 (11 years ago)
- Location:
- 2012/26/AleksanteriV/Water wey/Water wey
- Files:
-
- 5 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
2012/26/AleksanteriV/Water wey/Water wey/Water wey/Water_wey.cs
r3771 r3808 26 26 PhysicsObject vesi; 27 27 PhysicsObject palikka; 28 PhysicsObject kulma1; 29 PhysicsObject kulma2; 30 PhysicsObject kulma3; 31 PhysicsObject kulma4; 32 int siittiolkm = 0; 28 33 Pelaaja pelaaja; 29 34 Pelaaja pelaaja2; … … 34 39 IntMeter pistelaskuri2; 35 40 bool survival = false; 41 bool StoryMode = false; 36 42 37 43 public override void Begin() … … 49 55 { 50 56 survival = true; 57 StoryMode = false; 58 51 59 MediaPlayer.Play("musat/Mega game aqvashop"); 52 60 MediaPlayer.IsRepeating = true; … … 79 87 80 88 int Laskuri = 0; 81 // int laskuri2 = 0;82 89 while (Laskuri < 1000) 83 90 { … … 92 99 Laskuri++; 93 100 } 94 95 101 LuoKala(pelaaja); 96 102 LuoKala(pelaaja2); … … 99 105 void AloitaStoryMode() 100 106 { 107 StoryMode = true; 108 survival = false; 109 101 110 LuoKentta(); 102 111 Camera.Follow(pelaaja); 103 Camera.ZoomFactor = 10;112 Camera.ZoomFactor = 20; 104 113 MediaPlayer.Play("musat/Mega game aqvashop"); 105 114 MediaPlayer.IsRepeating = true; 106 //PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 107 Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, "Lopeta peli");//Confirm 108 115 Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, "Lopeta peli"); 109 116 Keyboard.Listen(Key.Space, ButtonState.Pressed, Begin, "aloita alusta"); 110 // Keyboard.Listen(Key.Right, ButtonState.Pressed, Gravity, new Vector(-100, 0);111 117 pistelaskuri1 = LuoPistelaskuriJaNaytto(Screen.Left + 100, Screen.Top - 100, new Color(0, 0, 255, 255), Color.White); 112 pistelaskuri2 = LuoPistelaskuriJaNaytto(Screen.Right - 100, Screen.Top - 100, new Color(255, 255, 0, 255), Color.Black); 113 114 //AddCollisionHandler(pelaaja, "siittio", CollisionHandler.AddMeterValue(pistelaskuri1, 1)); 115 //LuoSiittio(); 118 pistelaskuri1.MaxValue = siittiolkm; 119 AddCollisionHandler(pelaaja, "siittio", CollisionHandler.AddMeterValue(pistelaskuri1, 1)); 116 120 lisaaohjaimet(); 117 121 luopelaajalleelämänäytto(pelaaja, Screen.Left + 200, Screen.Top - 100); 118 119 // Gravity = new Vector(0, -500);120 122 Level.CreateBorders(); 121 //IsFullScreen = true;122 123 Level.Background.Image = LoadImage("kentta/underwater"); 123 124 Level.Background.FitToLevel(); 124 125 Camera.StayInLevel = true; 125 126 int Laskuri = 0; 127 // int laskuri2 = 0; 128 //while (Laskuri < 1000) 129 //{ 130 // vesi = new PhysicsObject(25, 25); 131 // vesi.Shape = Shape.Circle; 132 133 // vesi.Color = new Color(0, 0, 100, 5); 134 // vesi.Mass = 0.5; 135 // vesi.X = RandomGen.NextDouble(Level.Left, Level.Right); 136 // vesi.Y = RandomGen.NextDouble(Level.Bottom, Level.Top); 137 // Add(vesi); 138 // Laskuri++; 139 //} 140 141 142 } 143 144 145 //-----------------------------------------------------------------------Aliohjelmat 126 pistelaskuri1.UpperLimit += KaikkiKeratty; 127 } 146 128 void PainettiinValikonNappia(int valinta) 147 129 { … … 156 138 157 139 } 158 } 159 140 } 141 void KaikkiKeratty() 142 { 143 144 } 160 145 void LuoKentta() 161 146 { 162 //1. Luetaan kuva uuteen ColorTileMappiin, kuvan nimen perässä ei .png-päätettä.163 147 ColorTileMap kentta = ColorTileMap.FromLevelAsset("kentta/kentta1"); 164 165 //2. Kerrotaan mitä aliohjelmaa kutsutaan, kun tietyn värinen pikseli tulee vastaan kuvatiedostossa.166 148 kentta.SetTileMethod("00FF00", delegate(Vector paikka, double l, double k) { pelaaja = LuoPelaaja(paikka, 5, 2.5, pelaaja1Kuvat); pelaaja.Mass = 1000; pelaaja.LinearDamping = 0.96; }); 167 149 kentta.SetTileMethod(Color.Black, LuoPalikka); 168 150 kentta.SetTileMethod("FF006E", Luotausta); 169 151 kentta.SetTileMethod("FF0000", LuoSiittio); 152 kentta.SetTileMethod("0094FF", luokulma1); 153 kentta.SetTileMethod("00FFFF", luokulma2); 154 kentta.SetTileMethod("FF6A00", luokulma3); 155 kentta.SetTileMethod("FFD800", luokulma4); 170 156 kentta.Execute(2, 2); 171 157 } 172 173 174 158 IntMeter LuoPistelaskuriJaNaytto(double x, double y, Color naytonTausta, Color tekstinVari) 175 159 { … … 187 171 188 172 } 189 173 void luokulma1(Vector paikka, double leveys, double korkeus) 174 { 175 PhysicsObject kulma1 = PhysicsObject.CreateStaticObject(leveys, korkeus); 176 kulma1.Position = paikka; 177 kulma1.Shape = Shape.FromImage(LoadImage("kentta/kulma1")); 178 kulma1.Image = LoadImage("kentta/kulma1"); 179 Add(kulma1); 180 } 181 void luokulma2(Vector paikka, double leveys, double korkeus) 182 { 183 PhysicsObject kulma2 = PhysicsObject.CreateStaticObject(leveys, korkeus); 184 kulma2.Position = paikka; 185 kulma2.Shape = Shape.FromImage(LoadImage("kentta/kulma2")); 186 kulma2.Image = LoadImage("kentta/kulma2"); 187 Add(kulma2); 188 } 189 void luokulma3(Vector paikka, double leveys, double korkeus) 190 { 191 PhysicsObject kulma3 = PhysicsObject.CreateStaticObject(leveys, korkeus); 192 kulma3.Position = paikka; 193 kulma3.Shape = Shape.FromImage(LoadImage("kentta/kulma3")); 194 kulma3.Image = LoadImage("kentta/kulma3"); 195 Add(kulma3); 196 } 197 void luokulma4(Vector paikka, double leveys, double korkeus) 198 { 199 PhysicsObject kulma4 = PhysicsObject.CreateStaticObject(leveys, korkeus); 200 kulma4.Position = paikka; 201 kulma4.Shape = Shape.FromImage(LoadImage("kentta/kulma4")); 202 kulma4.Image = LoadImage("kentta/kulma4"); 203 Add(kulma4); 204 } 190 205 void Luotausta(Vector paikka, double leveys, double korkeus) 191 206 { … … 194 209 tausta.Color = Color.Black; 195 210 Add(tausta); 196 } 197 211 } 198 212 void LuoPalikka(Vector paikka, double leveys, double korkeus) 199 213 { … … 204 218 Add(palikka); 205 219 } 206 207 220 void LuoSiittio(Vector paikka, double leveys, double korkeus) 208 221 { 209 222 PhysicsObject siittio = new PhysicsObject(leveys, korkeus); 210 223 siittio.Shape = Shape.Circle; 224 siittio.Angle = RandomGen.NextAngle(); 211 225 siittio.Animation = new Animation(LoadImages("pisteet,enut/siiittio", "pisteet,enut/siiittio2", "pisteet,enut/siiittio3", "pisteet,enut/siiittio4", "pisteet,enut/siiittio5", "pisteet,enut/siiittio6")); 212 226 siittio.Animation.FPS = 10; … … 215 229 siittio.Tag = "siittio"; 216 230 siittio.Position = paikka; 231 siittiolkm = siittiolkm + 1; 217 232 Add(siittio); 218 233 } 219 220 234 Pelaaja LuoPelaaja(Vector paikka, double pit, double lev, Image[] animaatioKuvat) 221 235 { … … 227 241 pelaaja.Animation.FPS = 10; 228 242 pelaaja.Animation.Start(); 229 // pelaaja.Tag = "";230 243 Add(pelaaja); 231 244 AddCollisionHandler(pelaaja, "siittio", CollisionHandler.DestroyTarget); 232 245 AddCollisionHandler<Pelaaja, PhysicsObject>(pelaaja, "kala", kalaOsuu); 246 if (StoryMode) 247 { 248 /*AddCollisionHandler<PhysicsObject, PhysicsObject>(pelaaja, "siittio", delegate 249 { 250 251 });*/ 252 } 233 253 if (survival) 234 254 { … … 255 275 256 276 } 257 258 //void luopelaaja2()//Vector paikka, double leveys, double korkeus259 //{260 // pelaaja2 = new PhysicsObject(100, 50);261 // pelaaja2.Shape = Shape.FromImage(LoadImage("KALA20.1"));262 // pelaaja2.Position = new Vector(-100, 100);263 // pelaaja2.Mass = 100;264 // pelaaja2.Animation = new Animation(LoadImages("KALA20.1", "KALA20.2", "KALA20.1", "KALA20.3"));265 // pelaaja2.Animation.FPS = 10;266 // pelaaja2.Animation.Start();267 // //(pelaaja.Tag = "";)268 // Add(pelaaja2);269 270 271 // // AddCollisionHandler(pelaaja, "palikka", PysaytaPelaaja);272 //}273 274 277 void LuoKala(PhysicsObject seurattava) 275 278 { … … 300 303 nopeuttaja.Start(); 301 304 } 302 303 305 void kalaOsuu(Pelaaja player, PhysicsObject kala) 304 306 { … … 313 315 } 314 316 } 315 316 //---------------------------------------------------------------Ohjaimet317 318 317 void lisaaohjaimet() 319 318 { … … 357 356 pelaaja.Push(pelaajanSuunta); 358 357 } 359 360 //-------------------------------------------------------------361 362 363 358 } -
2012/26/AleksanteriV/Water wey/Water wey/Water weyContent/Water weyContent.contentproj
r3771 r3808 250 250 </Compile> 251 251 </ItemGroup> 252 <ItemGroup> 253 <Compile Include="kentta\kulma1.png"> 254 <Name>kulma1</Name> 255 <Importer>TextureImporter</Importer> 256 <Processor>TextureProcessor</Processor> 257 </Compile> 258 <Compile Include="kentta\kulma2.png"> 259 <Name>kulma2</Name> 260 <Importer>TextureImporter</Importer> 261 <Processor>TextureProcessor</Processor> 262 </Compile> 263 <Compile Include="kentta\kulma3.png"> 264 <Name>kulma3</Name> 265 <Importer>TextureImporter</Importer> 266 <Processor>TextureProcessor</Processor> 267 </Compile> 268 <Compile Include="kentta\kulma4.png"> 269 <Name>kulma4</Name> 270 <Importer>TextureImporter</Importer> 271 <Processor>TextureProcessor</Processor> 272 </Compile> 273 </ItemGroup> 274 <ItemGroup> 275 <Compile Include="kentta\kentta2.png"> 276 <Name>kentta2</Name> 277 <Importer>TextureImporter</Importer> 278 <Processor>TextureProcessor</Processor> 279 </Compile> 280 </ItemGroup> 252 281 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 253 282 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Note: See TracChangeset
for help on using the changeset viewer.