- Timestamp:
- 2011-06-17 11:55:09 (12 years ago)
- Location:
- 2011/24/EkiM
- Files:
-
- 6 added
- 1 deleted
- 6 copied
Legend:
- Unmodified
- Added
- Removed
-
2011/24/EkiM/Labyrinth.csproj
r775 r2087 1 <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> 1 <?xml version="1.0" encoding="utf-8"?> 2 <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> 2 3 <PropertyGroup> 3 4 <ProjectGuid>{4396209C-F1A5-4D34-9D86-5205D2852CE9}</ProjectGuid> … … 9 10 <RootNamespace>Labyrinth</RootNamespace> 10 11 <AssemblyName>Labyrinth</AssemblyName> 11 <TargetFrameworkVersion>v 3.5</TargetFrameworkVersion>12 <XnaFrameworkVersion>v 3.1</XnaFrameworkVersion>12 <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> 13 <XnaFrameworkVersion>v4.0</XnaFrameworkVersion> 13 14 <XnaPlatform>Windows</XnaPlatform> 14 15 <XnaCrossPlatformGroupID>37ce5dc9-7bc5-4a71-99a0-dbaeb972a4ff</XnaCrossPlatformGroupID> … … 16 17 <Thumbnail>GameThumbnail.png</Thumbnail> 17 18 <IsWebBootstrapper>false</IsWebBootstrapper> 19 <XnaUpgrade> 20 </XnaUpgrade> 21 <XnaOutputType>Game</XnaOutputType> 22 <XnaProfile>HiDef</XnaProfile> 23 <TargetFrameworkProfile>Client</TargetFrameworkProfile> 24 <FileUpgradeFlags> 25 </FileUpgradeFlags> 26 <OldToolsVersion>3.5</OldToolsVersion> 27 <UpgradeBackupLocation /> 18 28 <PublishUrl>publish\</PublishUrl> 19 29 <Install>true</Install> … … 43 53 <PlatformTarget>x86</PlatformTarget> 44 54 <XnaCompressContent>false</XnaCompressContent> 55 <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> 45 56 </PropertyGroup> 46 57 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> … … 54 65 <UseVSHostingProcess>false</UseVSHostingProcess> 55 66 <PlatformTarget>x86</PlatformTarget> 56 <XnaCompressContent>true</XnaCompressContent> 67 <XnaCompressContent>True</XnaCompressContent> 68 <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> 57 69 </PropertyGroup> 58 70 <ItemGroup> 59 <Reference Include="Jypeli2, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86"> 60 <SpecificVersion>False</SpecificVersion> 61 <HintPath>..\..\..\lib\Jypeli2.dll</HintPath> 62 </Reference> 63 <Reference Include="Microsoft.Xna.Framework, Version=3.1.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d"> 64 <HintPath>..\..\..\Program Files\Microsoft XNA\XNA Game Studio\v3.1\References\Windows\x86\Microsoft.Xna.Framework.dll</HintPath> 65 </Reference> 66 <Reference Include="Microsoft.Xna.Framework.Game, Version=3.1.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d" /> 71 <Reference Include="Jypeli4"> 72 <HintPath>..\..\..\..\Program Files\Jypeli\lib\x86\Jypeli4.dll</HintPath> 73 </Reference> 74 <Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553"> 75 <Private>False</Private> 76 </Reference> 77 <Reference Include="Microsoft.Xna.Framework.Avatar, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL"> 78 <Private>False</Private> 79 </Reference> 80 <Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553"> 81 <Private>False</Private> 82 </Reference> 83 <Reference Include="Microsoft.Xna.Framework.GamerServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL"> 84 <Private>False</Private> 85 </Reference> 86 <Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86"> 87 <Private>False</Private> 88 </Reference> 89 <Reference Include="Microsoft.Xna.Framework.Input.Touch, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL"> 90 <Private>False</Private> 91 </Reference> 92 <Reference Include="Microsoft.Xna.Framework.Net, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL"> 93 <Private>False</Private> 94 </Reference> 95 <Reference Include="Microsoft.Xna.Framework.Storage, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL"> 96 <Private>False</Private> 97 </Reference> 98 <Reference Include="Microsoft.Xna.Framework.Video, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL"> 99 <Private>False</Private> 100 </Reference> 101 <Reference Include="Microsoft.Xna.Framework.Xact, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86"> 102 <Private>False</Private> 103 </Reference> 67 104 <Reference Include="mscorlib"> 68 105 <Private>False</Private> … … 75 112 </Reference> 76 113 <Reference Include="System.Core"> 77 <RequiredTargetFramework>3.5</RequiredTargetFramework>78 114 <Private>False</Private> 79 115 </Reference> 80 116 <Reference Include="System.Xml.Linq"> 81 <RequiredTargetFramework>3.5</RequiredTargetFramework>82 117 <Private>False</Private> 83 118 </Reference> … … 98 133 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 99 134 </None> 100 <Content Include="kentta final.txt" />135 <Content Include="kentta3.txt" /> 101 136 <Content Include="monster.png" /> 102 137 <Content Include="player1.png" /> … … 112 147 <BootstrapperPackage Include="Microsoft.Net.Client.3.5"> 113 148 <Visible>False</Visible> 114 <ProductName>.NET Framework Client Profile</ProductName>149 <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName> 115 150 <Install>false</Install> 116 151 </BootstrapperPackage> … … 145 180 <Install>true</Install> 146 181 </BootstrapperPackage> 182 <BootstrapperPackage Include="Microsoft.Xna.Framework.4.0"> 183 <Visible>False</Visible> 184 <ProductName>Microsoft XNA Framework Redistributable 4.0</ProductName> 185 <Install>true</Install> 186 </BootstrapperPackage> 187 </ItemGroup> 188 <ItemGroup> 189 <ProjectReference Include="Content\LabyrinthContent.contentproj"> 190 <Project>{3492C2A5-FBFB-4DC6-903E-2291BEB7E382}</Project> 191 <Name>LabyrinthContent %28Content%29</Name> 192 <XnaReferenceType>Content</XnaReferenceType> 193 </ProjectReference> 147 194 </ItemGroup> 148 195 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> -
2011/24/EkiM/Peli.cs
r777 r2087 1 1 using System; 2 2 using Jypeli; 3 using Jypeli.ScreenObjects;4 3 using Jypeli.Assets; 4 using Jypeli.Widgets; 5 5 using System.Collections.Generic; 6 7 8 namespace Labyrinth // © Eki Majankallio 2010 6 using Jypeli.Controls; 7 8 9 10 namespace Labyrinth 9 11 { 10 12 public class Peli : PhysicsGame 11 13 { 12 14 15 13 16 PhysicsObject Pelaaja1; 14 17 PhysicsObject Pelaaja2; 15 18 PhysicsObject Maali; 16 19 17 int pisteitaKentassa = 0; 18 19 const int RuudunLeveys = 50; 20 const int RuudunKorkeus = 70; 20 Image pelaajan1Kuva = LoadImage("player1"); 21 Image pelaajan2Kuva = LoadImage("player2"); 22 Image hirvionKuva = LoadImage("monster"); 23 Image maalinKuva = LoadImage("goal"); 24 Image ruoanKuva = LoadImage("food"); 25 26 int pisteitakentassa = 0; 27 21 28 22 29 int kentanNro = 1; … … 25 32 int pisteitakeratty = 0; 26 33 27 Timer kentanVaihtoAjastin; 28 29 protected override void Begin() 30 { 34 public override void Begin() 35 36 { 37 38 SetWindowSize(1280,1024, true ); 39 Valikko(); 40 } 41 42 43 44 private void AloitaPeli() 45 { 46 ClearAll(); 31 47 LuoPisteLaskurit(); 32 MessageDisplay.TextColor = Color.White; 33 34 var merkit = new Dictionary<char, ObjectCreator>(); 35 merkit['x'] = LuoSeina; 36 merkit['D'] = LuoHirvio; 37 merkit['0'] = LuoRuoka; 38 merkit['1'] = LuoPelaaja1; 39 merkit['2'] = LuoPelaaja2; 40 merkit['F'] = LuoMaali; 41 42 char[,] ruudut = Tiles.ReadFromFile("kentta1.txt"); 43 44 Tiles.Insert(this, ruudut, merkit, RuudunLeveys, RuudunKorkeus); 45 48 49 50 MediaPlayer.IsRepeating = true; 51 MediaPlayer.Play("taustamusa"); 52 SoundEffect ruokaAani = LoadSoundEffect("ruoka"); 53 54 55 56 57 TileMap merkit = TileMap.FromFile("kentta1.txt"); 58 59 merkit.SetTileMethod('x', LuoSeina); 60 merkit.SetTileMethod('D', LuoHirvio); 61 merkit.SetTileMethod('0', LuoRuoka); 62 merkit.SetTileMethod('1', LuoPelaaja1); 63 merkit.SetTileMethod('2', LuoPelaaja2); 64 merkit.SetTileMethod('F', LuoMaali); 65 merkit.Execute(40, 40); 66 Keyboard.Listen(Key.Escape, ButtonState.Pressed, Valikko, ""); 46 67 LuoOhjain(); 47 68 48 69 Camera.ZoomToLevel(); 49 70 } 71 72 void Valikko() 73 { 74 ClearAll(); 75 valikonKohdat = new List<Label>(); 76 77 MediaPlayer.IsRepeating = true; 78 MediaPlayer.Play("menumusa"); 79 80 Label kohta1 = new Label("Aloita uusi peli"); 81 kohta1.Position = new Vector(0, 40); 82 valikonKohdat.Add(kohta1); 83 84 Label kohta2 = new Label("Näytä peliohje"); 85 kohta2.Position = new Vector(0, 0); 86 valikonKohdat.Add(kohta2); 87 88 Label kohta3 = new Label("Lopeta"); 89 kohta3.Position = new Vector(0, -40); 90 valikonKohdat.Add(kohta3); 91 92 foreach (Label valikonKohta in valikonKohdat) 93 { 94 Add(valikonKohta); 95 } 96 97 Mouse.ListenOn(kohta1, MouseButton.Left, ButtonState.Pressed, AloitaPeli, null); 98 Mouse.ListenOn(kohta2, MouseButton.Left, ButtonState.Pressed, TietojaPelista, null); 99 Mouse.ListenOn(kohta3, MouseButton.Left, ButtonState.Pressed, Exit, null); 100 101 Mouse.IsCursorVisible = true; 102 //Mouse.ListenMovement(1.0, ValikossaLiikkuminen, null); 103 Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, ""); 104 } 105 List<Label> valikonKohdat; 106 107 50 108 51 109 void LuoPisteLaskurit() … … 53 111 // Pelaajan 2 pistelaskuri 54 112 pistelaskuri2 = new IntMeter(0); 55 ValueDisplay pisteNaytto2 = new ValueDisplay();113 Label pisteNaytto2 = new Label(); 56 114 pisteNaytto2.Text = "Pelaaja2 pisteet: "; 57 115 pisteNaytto2.X = Screen.Left + 100; 58 116 pisteNaytto2.Y = Screen.Top - 60; 59 pisteNaytto2.ValueColor = Color.Green;60 117 pisteNaytto2.TextColor = Color.Green; 61 118 pisteNaytto2.BindTo(pistelaskuri2); … … 64 121 // Pelaajan 1 pistelaskuri 65 122 pistelaskuri1 = new IntMeter(0); 66 ValueDisplay pisteNaytto1 = new ValueDisplay();123 Label pisteNaytto1 = new Label(); 67 124 pisteNaytto1.Text = "Pelaaja1 pisteet: "; 68 125 pisteNaytto1.X = Screen.Left + 100; 69 126 pisteNaytto1.Y = Screen.Top - 20; 70 pisteNaytto1.ValueColor = Color.Red;71 127 pisteNaytto1.TextColor = Color.Red; 72 128 pisteNaytto1.BindTo(pistelaskuri1); … … 74 130 } 75 131 76 PhysicsObject LuoPelaaja1() 77 { 78 Pelaaja1 = new PhysicsObject(40.0, 40.0); 79 Pelaaja1.IgnoresPhysicsLogics = true; 80 Pelaaja1.CanRotate = false; 132 void LuoPelaaja1(Vector paikka, double leveys, double korkeus) 133 { 134 Pelaaja1 = new PhysicsObject(32, 32); 135 Pelaaja1.Image = LoadImage("player1"); 81 136 Pelaaja1.Tag = "1"; 82 Pelaaja1.Image = LoadImage("player1"); 83 Add(Pelaaja1); 137 Pelaaja1.Position = paikka; 84 138 AddCollisionHandler(Pelaaja1, RuokaanTormays); 85 139 AddCollisionHandler(Pelaaja1, MaaliinTormays); 86 return Pelaaja1;87 88 } 89 90 PhysicsObject LuoPelaaja2() 91 {92 Pelaaja2 = new PhysicsObject(40.0, 40.0);93 Pelaaja2 .IgnoresPhysicsLogics = true;94 Pelaaja2. CanRotate = false;140 Add(Pelaaja1); 141 } 142 143 144 145 void LuoPelaaja2(Vector paikka, double leveys, double korkeus) 146 { 147 Pelaaja2 = new PhysicsObject(32, 32); 148 Pelaaja2.Image = LoadImage("player2"); 95 149 Pelaaja2.Tag = "2"; 96 Pelaaja2.Image = LoadImage("player2"); 97 Add(Pelaaja2); 150 Pelaaja2.Position = paikka; 98 151 AddCollisionHandler(Pelaaja2, RuokaanTormays); 99 152 AddCollisionHandler(Pelaaja2, MaaliinTormays); 100 return Pelaaja2;101 } 102 103 PhysicsObject LuoHirvio()104 { 105 PhysicsObject Hirvio = new PhysicsObject( 48.0, 48.0);153 Add(Pelaaja2); 154 } 155 156 void LuoHirvio(Vector paikka, double leveys, double korkeus) 157 { 158 PhysicsObject Hirvio = new PhysicsObject(38, 38); 106 159 Hirvio.Image = LoadImage("monster"); 107 Add(Hirvio);160 Hirvio.Position = paikka; 108 161 Hirvio.IgnoresCollisionResponse = true; 109 162 Hirvio.Velocity = new Vector(90.0, 0.0); 110 163 AddCollisionHandler(Hirvio, SeinaanTormays); 111 164 AddCollisionHandler(Hirvio, PelaajaanTormays); 112 return Hirvio;113 } 114 115 PhysicsObject LuoRuoka()116 { 117 PhysicsObject Ruoka = PhysicsObject.CreateStaticObject(50 .0, 50.0);165 Add(Hirvio); 166 } 167 168 void LuoRuoka(Vector paikka, double leveys, double korkeus) 169 { 170 PhysicsObject Ruoka = PhysicsObject.CreateStaticObject(50, 50); 118 171 Ruoka.IgnoresCollisionResponse = true; 119 172 Ruoka.Image = LoadImage("food"); 120 Ruoka. IgnoresPhysicsLogics = false;121 pisteitake ratty+= 1;173 Ruoka.Position = paikka; 174 pisteitakentassa += 1; 122 175 Add(Ruoka); 123 176 Ruoka.Tag = "r"; 124 return Ruoka; 125 } 126 127 PhysicsObject LuoMaali() 128 { 129 Maali = new PhysicsObject(50.0, 50.0); 177 Add(Ruoka); 178 } 179 180 void LuoMaali(Vector paikka, double leveys, double korkeus) 181 { 182 Maali = new PhysicsObject(50, 40); 183 Maali.Position = paikka; 130 184 Maali.Image = LoadImage("goal"); 131 185 Maali.IgnoresPhysicsLogics = true; … … 133 187 Maali.Restitution = 0.0; 134 188 Add(Maali); 135 return Maali;136 } 137 138 PhysicsObject LuoSeina()139 {140 PhysicsObject seina = PhysicsObject.CreateStaticObject(RuudunLeveys, RuudunKorkeus);141 seina. Shape = Shapes.Rectangle;189 } 190 191 void LuoSeina(Vector paikka, double leveys, double korkeus) 192 { 193 PhysicsObject seina = PhysicsObject.CreateStaticObject(40, 40); 194 seina.Shape = Shape.Rectangle; 195 seina.Position = paikka; 142 196 seina.Restitution = 0.0; 143 seina.IgnoresPhysicsLogics = true;197 seina.IgnoresPhysicsLogics = false; 144 198 seina.Color = Color.Black; 145 return seina; 146 147 } 199 Add(seina); 200 201 } 202 148 203 void LuoOhjain() 149 204 { 150 205 //näppäin alhaalla 206 //Pelaaja1 151 207 Keyboard.Listen(Key.Left, ButtonState.Down, LiikutaPelaajaaVasemmalle, null); 152 208 Keyboard.Listen(Key.Right, ButtonState.Down, LiikutaPelaajaaOikealle, null); 153 209 Keyboard.Listen(Key.Up, ButtonState.Down, LiikutaPelaajaaYlos, null); 154 210 Keyboard.Listen(Key.Down, ButtonState.Down, LiikutaPelaajaaAlas, null); 211 //Pelaaja2 155 212 Keyboard.Listen(Key.A, ButtonState.Down, LiikutaPelaaja2Vasemmalle, null); 156 213 Keyboard.Listen(Key.D, ButtonState.Down, LiikutaPelaaja2Oikealle, null); … … 159 216 160 217 //näppäin ylhäällä 218 //Pelaaja1 161 219 Keyboard.Listen(Key.Left, ButtonState.Released, Pelaaja1.StopHorizontal, null); 162 220 Keyboard.Listen(Key.Right, ButtonState.Released, Pelaaja1.StopHorizontal, null); 163 221 Keyboard.Listen(Key.Up, ButtonState.Released, Pelaaja1.StopVertical, null); 164 222 Keyboard.Listen(Key.Down, ButtonState.Released, Pelaaja1.StopVertical, null); 223 //Pelaaja2 165 224 Keyboard.Listen(Key.A, ButtonState.Released, Pelaaja2.StopHorizontal, null); 166 225 Keyboard.Listen(Key.D, ButtonState.Released, Pelaaja2.StopHorizontal, null); … … 179 238 void LiikutaPelaajaaOikealle() 180 239 { 181 Pelaaja1.Hit(new Vector( 20, 0));240 Pelaaja1.Hit(new Vector(10, 0)); 182 241 } 183 242 … … 199 258 void LiikutaPelaaja2Oikealle() 200 259 { 201 Pelaaja2.Hit(new Vector( 20, 0));260 Pelaaja2.Hit(new Vector(10, 0)); 202 261 } 203 262 … … 223 282 { 224 283 Pelaaja1.Destroy(); 225 TextDisplay viesti = new TextDisplay(); viesti.TextColor = Color.Red;284 Label viesti = new Label(); viesti.TextColor = Color.Red; 226 285 Add(viesti); 227 viesti.X = Screen.Left + 300; 228 viesti.Y = Screen.Top - 780; 229 viesti.Text = "Pelaaja1 joutui Hirviön kitaan!"; 286 viesti.X = Screen.Left + 500; 287 viesti.Y = Screen.Top - 700; 288 viesti.Text = "Pelaaja 1 joutui Hirviön kitaan! Pelaaja 2 voitti!"; 289 Timer kentanvaihto = new Timer(); 290 kentanvaihto.Interval = 2; 291 kentanvaihto.Trigger += VaihdaKenttaa; 292 kentanvaihto.Start(1); 230 293 } 231 294 if (kohde == Pelaaja2) 232 295 { 233 296 Pelaaja2.Destroy(); 234 TextDisplay viesti = new TextDisplay(); viesti.TextColor = Color.Green; 235 Add(viesti); 236 viesti.X = Screen.Left + 300; 237 viesti.Y = Screen.Top - 800; 238 viesti.Text = "Pelaaja2 joutui Hirviön kitaan!"; 239 240 } 241 if (Pelaaja1.IsDestroyed() && Pelaaja2.IsDestroyed()) 297 Label viesti2 = new Label(); viesti2.TextColor = Color.Green; 298 viesti2.X = Screen.Left + 500; 299 viesti2.Y = Screen.Top - 700; 300 MessageDisplay.Add("Pelaaja 2 joutui Hirviön kitaan! Pelaaja 1 voitti!"); 301 Timer kentanvaihto2 = new Timer(); 302 kentanvaihto2.Interval = 2; 303 kentanvaihto2.Trigger += VaihdaKenttaa; 304 kentanvaihto2.Start(1); 305 306 } 307 if (Pelaaja1.IsDestroyed && Pelaaja2.IsDestroyed) 242 308 { 243 309 Timer ajastin = new Timer(); 244 310 ajastin.Interval = 5; 245 311 ajastin.Trigger += LopetaPeli; 246 Add(ajastin);247 312 ajastin.Start(); 248 313 249 TextDisplay viesti = new TextDisplay(); viesti.TextColor = Color.Orange;250 Add(viesti);251 viesti .X = Screen.Left + 650;252 viesti .Y = Screen.Top - 780;253 viesti.Text = "Ei pelaajia kentällä, GAME OVER!";314 MessageDisplay viesti3 = new MessageDisplay(); 315 viesti3.Color = Color.Orange; 316 viesti3.X = Screen.Left + 500; 317 viesti3.Y = Screen.Top - 650; 318 MessageDisplay.Add("Ei pelaajia kentällä, Peli päättyy!"); 254 319 255 320 } … … 258 323 void RuokaanTormays(PhysicsObject tormaaja, PhysicsObject pallo) 259 324 { 260 if (pallo.Tag.ToString() == "r") // r-tägistä saa pisteitä 261 { 262 pisteitakeratty -= 1; 325 //ruokaAani.Play(); 326 327 if (pallo.Tag.ToString() == "r") // r-tagista saa pisteitä 328 { 329 pisteitakeratty += 1; 263 330 pallo.Destroy(); 264 331 if (tormaaja.Tag.ToString() == "1") … … 273 340 274 341 } 275 void MaaliinTormays(PhysicsObject voittaja, PhysicsObject tormattava)342 void MaaliinTormays(PhysicsObject maalitormaaja, PhysicsObject tormattava) 276 343 { 277 344 if (tormattava == Maali) 278 345 { 279 346 280 if (pisteitakeratty > pisteitaKentassa)347 if (pisteitakeratty < pisteitakentassa) 281 348 { 282 TextDisplay viesti = new TextDisplay(); 283 Add(viesti); 284 viesti.X = Screen.Left + 800; 285 viesti.Y = Screen.Top - 800; 286 viesti.Text = "Et ole kerännyt kaikkia pisteitä!"; 349 350 MessageDisplay.MessageTime = new TimeSpan(0, 0, 2); 351 MessageDisplay.Add("Et ole kerännyt kaikkia pisteitä!"); 352 MessageDisplay.MaxMessageCount = 0; 287 353 return; 288 354 } 289 355 290 if ( voittaja.Tag.ToString() == "1")356 if (maalitormaaja.Tag.ToString() == "1") 291 357 { 292 TextDisplay viesti = new TextDisplay(); 293 Add(viesti); 294 viesti.X = Screen.Left + 300; 295 viesti.Y = Screen.Top - 800; 296 viesti.Text = "Pelaaja1 voitti pelin!"; 358 359 MessageDisplay.Add("Pelaaja 1 voitti pelin!"); 360 MessageDisplay.MaxMessageCount = 1; 361 297 362 } 298 else if ( voittaja.Tag.ToString() == "2")363 else if (maalitormaaja.Tag.ToString() == "2") 299 364 { 300 TextDisplay viesti = new TextDisplay(); 301 viesti.TextColor = Color.White; 302 Add(viesti); 303 viesti.X = Screen.Left + 300; 304 viesti.Y = Screen.Top - 800; 305 viesti.Text = "Pelaaja2 voitti pelin!"; 306 TimeSpan aika = new TimeSpan(0, 0, 5); 307 viesti.MaximumLifetime = aika; 365 MessageDisplay.Add("Pelaaja 2 voitti pelin!"); 366 MessageDisplay.MaxMessageCount = 1; 367 308 368 } 309 369 310 kentanVaihtoAjastin = new Timer(); 311 kentanVaihtoAjastin.Interval = 2; 312 kentanVaihtoAjastin.Trigger += VaihdaKenttaa;313 Add(kentanVaihtoAjastin);314 kentanVaihtoAjastin.Start();315 }316 } 317 318 void VaihdaKenttaa(Timer t)319 {320 MessageDisplay.Add("Tultiin VaihdaKenttaa()-aliohjelmaan"); 321 322 kentanVaihtoAjastin.Stop();370 371 372 Timer ajastin = new Timer(); 373 ajastin.Interval = 2; 374 ajastin.Trigger += VaihdaKenttaa; 375 ajastin.Start(1); 376 377 378 } 379 } 380 381 void VaihdaKenttaa(Timer ajastin) 382 { 323 383 ClearAll(); 324 384 SeuraavaKentta(++kentanNro); … … 327 387 void SeuraavaKentta(int moneskoKentta) 328 388 { 329 MessageDisplay.Add 330 ("Vaihdetaan kenttää"); 389 331 390 if (moneskoKentta == 1) LuoKentta1(); 332 391 else if (moneskoKentta == 2) LuoKentta2(); 333 else if (moneskoKentta == 3) PeliLopetus();392 else if (moneskoKentta == 3) LuoKentta3(); 334 393 } 335 394 void LuoKentta1() 336 395 { 337 var merkit = new Dictionary<char, ObjectCreator>(); 338 merkit['x'] = LuoSeina; 339 merkit['D'] = LuoHirvio; 340 merkit['0'] = LuoRuoka; 341 merkit['1'] = LuoPelaaja1; 342 merkit['2'] = LuoPelaaja2; 343 merkit['F'] = LuoMaali; 344 345 char[,] ruudut = Tiles.ReadFromFile("kentta1.txt"); 346 347 Tiles.Insert(this, ruudut, merkit, RuudunLeveys, RuudunKorkeus); 348 349 396 TileMap merkit = TileMap.FromFile("kentta1.txt"); 397 398 merkit.SetTileMethod('x', LuoSeina); 399 merkit.SetTileMethod('D', LuoHirvio); 400 merkit.SetTileMethod('0', LuoRuoka); 401 merkit.SetTileMethod('1', LuoPelaaja1); 402 merkit.SetTileMethod('2', LuoPelaaja2); 403 merkit.SetTileMethod('F', LuoMaali); 404 merkit.Execute(40, 40); 405 406 LuoPisteLaskurit(); 350 407 Camera.ZoomToLevel(); 408 351 409 } 352 410 353 411 void LuoKentta2() 354 412 { 355 var merkit = new Dictionary<char, ObjectCreator>(); 356 merkit['x'] = LuoSeina; 357 merkit['D'] = LuoHirvio; 358 merkit['0'] = LuoRuoka; 359 merkit['1'] = LuoPelaaja1; 360 merkit['2'] = LuoPelaaja2; 361 merkit['F'] = LuoMaali; 362 363 char[,] ruudut = Tiles.ReadFromFile("kentta2.txt"); 364 365 Tiles.Insert(this, ruudut, merkit, RuudunLeveys, RuudunKorkeus); 413 //MediaPlayer.Play("kakkosmusa"); 414 TileMap merkit = TileMap.FromFile("kentta2.txt"); 415 416 merkit.SetTileMethod('x', LuoSeina); 417 merkit.SetTileMethod('D', LuoHirvio); 418 merkit.SetTileMethod('0', LuoRuoka); 419 merkit.SetTileMethod('1', LuoPelaaja1); 420 merkit.SetTileMethod('2', LuoPelaaja2); 421 merkit.SetTileMethod('F', LuoMaali); 422 merkit.Execute(40, 40); 423 424 Keyboard.Listen(Key.Escape, ButtonState.Pressed, Valikko, ""); 425 LuoOhjain(); 426 LuoPisteLaskurit(); 427 Camera.ZoomToLevel(); 428 } 429 void LuoKentta3() 430 { 431 //MediaPlayer.Play("kolmosmusa"); 432 TileMap merkit = TileMap.FromFile("kentta3.txt"); 433 434 merkit.SetTileMethod('x', LuoSeina); 435 merkit.SetTileMethod('D', LuoHirvio); 436 merkit.SetTileMethod('0', LuoRuoka); 437 merkit.SetTileMethod('1', LuoPelaaja1); 438 merkit.SetTileMethod('2', LuoPelaaja2); 439 merkit.SetTileMethod('F', LuoMaali); 440 merkit.Execute(40, 40); 366 441 367 442 LuoOhjain(); 368 443 Camera.ZoomToLevel(); 369 444 } 370 371 void LuoKentta3()372 {373 374 var merkit = new Dictionary<char, ObjectCreator>();375 merkit['x'] = LuoSeina;376 merkit['D'] = LuoHirvio;377 merkit['0'] = LuoRuoka;378 merkit['1'] = LuoPelaaja1;379 merkit['2'] = LuoPelaaja2;380 merkit['F'] = LuoMaali;381 382 char[,] ruudut = Tiles.ReadFromFile("kenttafinal.txt");383 384 Tiles.Insert(this, ruudut, merkit, RuudunLeveys, RuudunKorkeus);385 386 LuoOhjain();387 Camera.ZoomToLevel();388 }389 445 void LopetaPeli(Timer t) 390 446 { 391 447 Exit(); 392 448 } 393 void PeliLopetus() 394 { 395 TextDisplay viesti = new TextDisplay(); viesti.TextColor = Color.Red; 396 Add(viesti); 397 viesti.X = Screen.Left + 500; 398 viesti.Y = Screen.Top - 180; 399 viesti.Text = "LÄPÄISIT PELIN!"; 400 TextDisplay viesti2 = new TextDisplay(); viesti.TextColor = Color.Red; 401 Add(viesti2); 402 viesti2.X = Screen.Left + 500; 403 viesti2.Y = Screen.Top - 190; 404 viesti2.Text = "Pelistä saattaa tulla uusia versioita kesän aikana..."; 405 TextDisplay viesti3 = new TextDisplay(); viesti.TextColor = Color.Red; 406 Add(viesti3); 407 viesti3.X = Screen.Left + 500; 408 viesti3.Y = Screen.Top - 200; 409 viesti3.Text = "...joten jos haluat pelata, ota yhteyttä!"; 410 TextDisplay viesti4 = new TextDisplay(); viesti.TextColor = Color.Red; 411 Add(viesti4); 412 viesti4.X = Screen.Left + 500; 413 viesti4.Y = Screen.Top - 210; 414 viesti4.Text = "-Eki Majankallio"; 415 } 449 void TietojaPelista() 450 { 451 452 453 Label tietokentta = new Label("© AquaCrystal Studios \n \n Labyrinttiseikkailua kaksinpelinä, jossa fysiikan lait vaikuttavat. \n \n Musiikit: flashkit.com, calpomatt - American Beaty, calpomatt - Elysium \n \n Grafiikat: Eki Majankallio \n \n Ideointi: Eki Majankallio \n \n Ohjelmointi: Eki Majankallio \n \n Tätä peliä tullaan kehittämään edelleen. Tämä versio on beta 1.1 \n Uudet versiot löytyvät AquaCrystal Studiosin kotisivuilta www.aquacrystalstudios.tk"); 454 //tietokentta.BorderColor = Color.Red; 455 tietokentta.X = Screen.Left + 400; 456 tietokentta.Y = Screen.Top - 180; 457 Add(tietokentta); 458 459 } 416 460 } 417 461 } 418 419 -
2011/24/EkiM/copyrights.txt
r707 r2087 4 4 5 5 6 - Eki Majankallio -
2011/24/EkiM/kentta1.txt
r705 r2087 1 1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2 2 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 3 xx 1 x 0 xxx0000000 xx4 xx xxxxxx xxxxxxxxxxxx xxxxxxxxxxxxxxxxx3 xx 1 x 0 x 0000000 xx 4 xx xxxxxxx xxxxxxxxxxxx xxxxxxxxxxxxxxxx 5 5 xx x xx 6 xxxxxxxxxxxx x xxxxxxxx x x xx6 xxxxxxxxxxxx x D x x x xx 7 7 xxxxxx 00 x xxxxxxxxx x x 000000 xx 8 xxx Dxxxxxxxxx x xx8 xxx D xxxxxxxxx x xx 9 9 xxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx xx 10 xx D xx Dxx10 xx D xxx D xx 11 11 xxxxxxxxx xx xxxxxxxxxxxxxxxxxxxxxx xx 12 12 xx 000000 x xx 0000000 xx … … 16 16 xx xxxxxxxxxxxxxxxxx xxx xxxxxxxxxxx 17 17 xx xxxxxxxxxxxxx Fx xxx xxxxxxxxxxx 18 xx 2 xxxxxxxxxxxxx Dxxxxxxxxxxx18 xx 2 xxxxxxxxxxxxx D xxxxxxxxxxx 19 19 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 20 20 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -
2011/24/EkiM/kentta2.txt
r775 r2087 1 1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2 2 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 3 xx x 2 x F 4 xx 00000000000 x x 5 xx 00000000000 x x 6 xx 00000000000 x x 7 xx 00000000000 x x 000000000000000xx3 xx x 2 x Fx xx 4 xx 00000000000 x x x000000000000000 xx 5 xx 00000000000 x x x000000000000000 xx 6 xx 00000000000 x x x000000000000000 xx 7 xxxx00000000000 x x x000000000000000xxxx 8 8 xx D x x D xx 9 xx xxxxxxxxxxxxxxx 9 xx xxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx xx 10 10 xx xx 11 xx xxxxxxxxxxxxxxx 11 xx xxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx xx 12 12 xx D x x D xx 13 xx x x 0000000000000000xx14 xx 0000000000000 x x 0000000000000000xx15 xx 0000000000000 x x 0000000000000000xx16 xx 0000000000000 x x 0000000000000000xx13 xxxx0000000000000 x x 0000000000000000xxxx 14 xx 0000000000000 x x 0000000000000000 xx 15 xx 0000000000000 x x 0000000000000000 xx 16 xx 0000000000000 x x 0000000000000000 xx 17 17 xx x 1 x xx 18 18 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Note: See TracChangeset
for help on using the changeset viewer.