- Timestamp:
- 2013-06-12 14:59:14 (9 years ago)
- Location:
- 2013/24/EemeliK
- Files:
-
- 16 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
2013/24/EemeliK/KillSlender/KillSlender/KillSlender/KillSlender.cs
r4074 r4095 11 11 PhysicsObject pelaaja; 12 12 Image tyyppi = LoadImage("tyyppi"); 13 int kenttaNro = 1; 14 15 Color[] kenttienTaustavarit = { Color.LightBlue, Color.LightBlue, Color.Black }; 13 Image RahaKuva = LoadImage("rahapussi"); 14 Image BarrelKuva = LoadImage("barrel"); 15 Image StephanoKuva = LoadImage("stephano"); 16 IntMeter Rahalaskuri; 17 int kenttaNro = 5; 18 19 Color[] kenttienTaustavarit = { Color.LightBlue, Color.LightBlue, Color.Black, Color.Green, Color.Green }; 16 20 17 21 public override void Begin() 18 22 { 19 23 // TODO: 20 21 22 seuraavakentta(); 23 24 25 } 24 MediaPlayer.Play("taustamusiikki"); 25 LuoRahalaskuri(); 26 seuraavakentta(); 27 } 28 26 29 void seuraavakentta() 27 30 { … … 31 34 else if (kenttaNro == 2) LuoKentta("kentta2"); 32 35 else if (kenttaNro == 3) LuoKentta("kentta3"); 33 else if (kenttaNro > 3) Exit(); 34 36 else if (kenttaNro == 4) LuoKentta("kentta4"); 37 else if (kenttaNro == 5) LuoKentta("kentta5"); 38 else if (kenttaNro > 5) Exit(); 35 39 } 36 40 … … 85 89 Gravity = new Vector(0.0, -800.0); 86 90 TileMap ruudut = TileMap.FromLevelAsset(Kenttatiedosto); 87 ruudut.SetTileMethod(' S', LuoSlender);91 ruudut.SetTileMethod('s', LuoSlender); 88 92 ruudut.SetTileMethod('1', LuoPelaaja, LoadImage("tyyppi")); 89 93 ruudut.SetTileMethod('2', LuoPelaaja, LoadImage("tyyppi2")); … … 91 95 ruudut.SetTileMethod('*', LuoTNT); 92 96 ruudut.SetTileMethod('E', LuoEyes); 97 ruudut.SetTileMethod('$', LuoRaha); 98 ruudut.SetTileMethod('M', LuoMorso); 99 ruudut.SetTileMethod('B', LuoBarrel); 100 ruudut.SetTileMethod('p', Luopewdiepie); 101 ruudut.SetTileMethod('i', Luoirresponsibledad); 102 ruudut.SetTileMethod('S', LuoStephano); 93 103 ruudut.Execute(20, 20); 94 104 Keyboard.Listen(Key.Left, ButtonState.Down, LiikutaPelaajaa, null, new Vector(-1000, 0)); … … 99 109 IsPaused = true; 100 110 Camera.Follow(pelaaja); 101 pelaaja.LifetimeLeft = TimeSpan.FromSeconds(60.0);102 111 Level.BackgroundColor = kenttienTaustavarit[kenttaNro - 1]; 112 AddCollisionHandler(pelaaja, "Raha", PelaajaOsuu); 113 AddCollisionHandler(pelaaja, "Stephano", PelaajaOsuu); 114 115 if (kenttaNro == 4) 116 { 117 Timer ajastin = new Timer(); 118 ajastin.Interval = 15; 119 ajastin.Start(); 120 ajastin.Timeout += delegate { VaihdaKentta(null, null); }; //HUOM! kaks null arvoa parametreinä 121 122 123 } 124 103 125 } 104 126 void LuoSlender(Vector paikka, double leveys, double korkeus) … … 122 144 seuraavakentta(); 123 145 } 146 124 147 void vaihdakentta(PhysicsObject tormaaja, PhysicsObject kohde) 125 148 { … … 128 151 MessageDisplay.Add("Pääsit läpi"); 129 152 } 153 130 154 void LuoEyes(Vector paikka, double leveys, double korkeus) 131 155 { … … 143 167 144 168 } 145 169 170 171 172 void LuoRaha(Vector paikka, double leveys, double korkeus) 173 { 174 PhysicsObject Raha = PhysicsObject.CreateStaticObject(100, 100); 175 Raha.IgnoresCollisionResponse = true; 176 Raha.Position = paikka; 177 Raha.Image = RahaKuva; 178 Raha.Tag = "Raha"; 179 Add(Raha); 180 Rahalaskuri.Value++; 181 } 182 void PelaajaOsuu(PhysicsObject pelaaja, PhysicsObject Raha) 183 { 184 185 Raha.Destroy(); 186 Rahalaskuri.Value--; 187 } 188 void LuoRahalaskuri() 189 { 190 Rahalaskuri = new IntMeter(0, 0, 14);//Tähtien määrä 191 Rahalaskuri.LowerLimit += new Action(Rahalaskuri_LowerLimit); 192 } 193 194 void Rahalaskuri_LowerLimit() 195 { 196 kenttaNro++; 197 seuraavakentta(); 198 MessageDisplay.Add("Pääsit läpi"); 199 } 200 void LuoMorso(Vector paikka, double leveys, double korkeus) 201 { 202 PhysicsObject morso = new PhysicsObject(150, 200); 203 morso.Shape = Shape.Rectangle; 204 morso.Tag = "morso"; 205 Add(morso); 206 FollowerBrain seuraajanAivot = new FollowerBrain(pelaaja); 207 morso.Brain = seuraajanAivot; 208 seuraajanAivot.Speed = 500; 209 Image olionKuva = LoadImage("morso"); 210 morso.Image = olionKuva; 211 AddCollisionHandler(pelaaja, morso, CollisionHandler.ExplodeObject(100, true)); 212 morso.Position = paikka; 213 214 } 215 void LuoBarrel(Vector paikka, double leveys, double korkeus) 216 { 217 PhysicsObject Barrel = PhysicsObject.CreateStaticObject(50, 50); 218 Barrel.Position = paikka; 219 Barrel.Shape = Shape.Rectangle; 220 Barrel.Color = Color.Gray; 221 Add(Barrel); 222 Barrel.Image = BarrelKuva; 223 224 } 225 void Luopewdiepie(Vector paikka, double leveys, double korkeus) 226 { 227 PhysicsObject pewdiepie = new PhysicsObject(150, 200); 228 pewdiepie.Shape = Shape.Rectangle; 229 pewdiepie.Tag = "pewdiepie"; 230 Add(pewdiepie); 231 FollowerBrain seuraajanAivot = new FollowerBrain(pelaaja); 232 pewdiepie.Brain = seuraajanAivot; 233 seuraajanAivot.Speed = 500; 234 Image olionKuva = LoadImage("pewdiepie"); 235 pewdiepie.Image = olionKuva; 236 AddCollisionHandler(pelaaja, pewdiepie, CollisionHandler.ExplodeObject(100, true)); 237 pewdiepie.Position = paikka; 238 } 239 void Luoirresponsibledad(Vector paikka, double leveys, double korkeus) 240 { 241 PhysicsObject irresponsibledad = new PhysicsObject(150, 200); 242 irresponsibledad.Shape = Shape.Rectangle; 243 irresponsibledad.Tag = "irresponsibledad"; 244 Add(irresponsibledad); 245 FollowerBrain seuraajanAivot = new FollowerBrain(pelaaja); 246 irresponsibledad.Brain = seuraajanAivot; 247 seuraajanAivot.Speed = 500; 248 Image olionKuva = LoadImage("irresponsibledad"); 249 irresponsibledad.Image = olionKuva; 250 AddCollisionHandler(pelaaja, irresponsibledad, CollisionHandler.ExplodeObject(100, true)); 251 irresponsibledad.Position = paikka; 252 } 253 void LuoStephano(Vector paikka, double leveys, double korkeus) 254 { 255 PhysicsObject Stephano = PhysicsObject.CreateStaticObject(100, 100); 256 Stephano.IgnoresCollisionResponse = true; 257 Stephano.Position = paikka; 258 Stephano.Image = StephanoKuva; 259 Stephano.Tag = "Stephano"; 260 Add(Stephano); 261 Rahalaskuri.Value++; 262 } 146 263 } 147 264 … … 155 272 156 273 274 275 -
2013/24/EemeliK/KillSlender/KillSlender/KillSlenderContent/KillSlenderContent.contentproj
r4074 r4095 111 111 </Compile> 112 112 </ItemGroup> 113 <ItemGroup> 114 <Compile Include="kentta4.txt"> 115 <Name>kentta4</Name> 116 <Importer>TextFileImporter</Importer> 117 <Processor>TextFileContentProcessor</Processor> 118 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 119 </Compile> 120 </ItemGroup> 121 <ItemGroup> 122 <Compile Include="morso.png"> 123 <Name>morso</Name> 124 <Importer>TextureImporter</Importer> 125 <Processor>TextureProcessor</Processor> 126 </Compile> 127 </ItemGroup> 128 <ItemGroup> 129 <Compile Include="taustamusiikki.mp3"> 130 <Name>taustamusiikki</Name> 131 <Importer>Mp3Importer</Importer> 132 <Processor>SongProcessor</Processor> 133 </Compile> 134 </ItemGroup> 135 <ItemGroup> 136 <Compile Include="kentta5.txt"> 137 <Name>kentta5</Name> 138 <Importer>TextFileImporter</Importer> 139 <Processor>TextFileContentProcessor</Processor> 140 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 141 </Compile> 142 </ItemGroup> 143 <ItemGroup> 144 <Compile Include="pewdiepie.png"> 145 <Name>pewdiepie</Name> 146 <Importer>TextureImporter</Importer> 147 <Processor>TextureProcessor</Processor> 148 </Compile> 149 </ItemGroup> 150 <ItemGroup> 151 <Compile Include="barrel.png"> 152 <Name>barrel</Name> 153 <Importer>TextureImporter</Importer> 154 <Processor>TextureProcessor</Processor> 155 </Compile> 156 </ItemGroup> 157 <ItemGroup> 158 <Compile Include="irresponsibledad.png"> 159 <Name>irresponsibledad</Name> 160 <Importer>TextureImporter</Importer> 161 <Processor>TextureProcessor</Processor> 162 </Compile> 163 </ItemGroup> 164 <ItemGroup> 165 <Compile Include="stephano.png"> 166 <Name>stephano</Name> 167 <Importer>TextureImporter</Importer> 168 <Processor>TextureProcessor</Processor> 169 </Compile> 170 </ItemGroup> 113 171 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 114 172 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2013/24/EemeliK/KillSlender/KillSlender/KillSlenderContent/kentta1.txt
r4074 r4095 20 20 = = 21 21 = = 22 = S=22 = s = 23 23 = = 24 24 = = … … 48 48 = = 49 49 = = 50 = 50 = = 51 51 = = 52 52 = = -
2013/24/EemeliK/KillSlender/KillSlender/KillSlenderContent/kentta2.txt
r4074 r4095 14 14 = ============== = = 15 15 = = = * = 16 = S= = =16 = s = = = 17 17 = = = = 18 18 = = = = -
2013/24/EemeliK/KillSlender/KillSlender/KillSlenderContent/kentta3.txt
r4074 r4095 1 1 ==================================================================================== ========================================================================================================================================== 2 = = = = 3 = = = = 4 = = = $ = 5 = = = = 6 = = = = 7 = = = = 8 = = = $ $ = 9 = $ = = = 2 10 = = = = 3 11 = = = = 4 12 = = = = 5 13 = = = = 14 = = = $ $ = 6 15 = = = = 7 16 = = = = 8 17 = = = = 9 = = = = 10 = = = = 11 = = = = 12 = = = = 13 = = = = 14 = = = = 15 = = = = 16 = = = = 17 = = = = 18 = ==================================================================================== =================================================================== 18 = $ ==================================================================================== $ =================================================================== 19 19 = = 20 20 = = … … 22 22 = = 23 23 = = 24 = $ = 24 25 = = 25 26 = = 26 27 = = 27 28 = = 28 = = 29 = 2 = 29 = 2 $ = 30 30 = = 31 31 = = … … 34 34 = E = 35 35 = = 36 = $ $ $ = 36 37 = = 37 38 = = 38 39 = = 39 = 40 = $ = 40 41 = = 41 42 = =
Note: See TracChangeset
for help on using the changeset viewer.