Changeset 1125
- Timestamp:
- 2010-07-07 11:29:55 (13 years ago)
- Location:
- 2010/27/frjolehm/The King of the island/The King of the island
- Files:
-
- 3 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/27/frjolehm/The King of the island/The King of the island/Content/Content.contentproj
r1100 r1125 1 <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">1 <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> 2 2 <PropertyGroup> 3 3 <ProjectGuid>58cbff05-d23b-4e2b-ae4d-8769f79e71f8</ProjectGuid> … … 34 34 <Reference Include="Microsoft.Xna.Framework.Content.Pipeline.XImporter, Version=3.1.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d" /> 35 35 </ItemGroup> 36 <ItemGroup> 37 <Compile Include="Tipu1.png"> 38 <Name>Tipu1</Name> 39 <Importer>TextureImporter</Importer> 40 <Processor>TextureProcessor</Processor> 41 </Compile> 42 </ItemGroup> 36 43 </Project> -
2010/27/frjolehm/The King of the island/The King of the island/Peli.cs
r1100 r1125 6 6 public class Peli : PhysicsGame 7 7 { 8 PlatformCharacter pelaaja1; 9 PlatformCharacter pelaaja2; 10 11 PhysicsObject vasenreuna; 12 PhysicsObject oikeareuna; 13 PhysicsObject alareuna; 14 PhysicsObject yläreuna; 15 16 Boolean Pelaajan1JuoksuAskel; 17 Boolean Pelaajan2JuoksuAskel; 18 19 const double Juoksunopeus = 20; 20 8 21 protected override void Begin() 9 22 { 10 //TODO: Alusta peli tässä 23 Aloitapikkupeli(1); 24 } 25 26 void Aloitapikkupeli(int peliMuoto) 27 { 28 //Kuoleman juoksu 29 if (peliMuoto == 1){ 30 LuoKenttä(800,700); 31 AddCollisionHandler(oikeareuna, JuoksuVoitto); 32 pelaaja1 = LuoUkko(Level.Left + 30,Level.Bottom + 75,100, 100); 33 pelaaja2 = LuoUkko(Level.Left+ 30,Level.Bottom + 200, 100, 100); 34 JuoksuOhjaimet(); 35 } 36 37 } 38 39 void LuoKenttä(double width, double height) 40 { 41 Level.Width = width; 42 Level.Height = height; 43 44 vasenreuna = Level.CreateLeftBorder(); 45 vasenreuna.IsVisible = false; 46 47 oikeareuna = Level.CreateRightBorder(); 48 oikeareuna.IsVisible = false; 49 50 yläreuna = Level.CreateTopBorder(); 51 yläreuna.IsVisible = false; 52 53 alareuna = Level.CreateBottomBorder(); 54 alareuna.IsVisible = false; 55 56 57 Camera.ZoomToLevel(); 58 59 } 60 61 void JuoksuOhjaimet() 62 { 63 Keyboard.Listen(Key.A, ButtonState.Pressed, LuoJuoksu, "Pelaaja liikkuu", pelaaja1, false, false); 64 Keyboard.Listen(Key.D, ButtonState.Pressed, LuoJuoksu, "Pelaaja liikkuu", pelaaja1, false, true); 65 66 Keyboard.Listen(Key.Left, ButtonState.Pressed, LuoJuoksu, "Pelaaja2 liikkuu", pelaaja2, true, false); 67 Keyboard.Listen(Key.Right, ButtonState.Pressed, LuoJuoksu, "Pelaaja2 liikkuu", pelaaja2, true, true); 68 } 69 70 // ukko false = p1 true = p2 false = n1 true = n2 71 void LuoJuoksu(PlatformCharacter ukko, Boolean pelaaja, Boolean näppäin) 72 { 73 //Pelaaja 1 74 if (pelaaja == false) 75 { 76 if (näppäin == Pelaajan1JuoksuAskel) 77 { 78 Liikuta(ukko, Juoksunopeus); 79 if (Pelaajan1JuoksuAskel == true) 80 { 81 Pelaajan1JuoksuAskel = false; 82 } 83 84 } 85 } 86 else 87 { 88 if (näppäin == Pelaajan2JuoksuAskel) 89 { 90 Liikuta(ukko, Juoksunopeus); 91 if (Pelaajan2JuoksuAskel == true) 92 { 93 Pelaajan2JuoksuAskel = false; 94 } 95 } 96 } 97 } 98 99 void JuoksuVoitto(PhysicsObject maali, PlatformCharacter kohde) 100 { 101 if(kohde == pelaaja1) 102 { 103 ClearAll(); 104 } 105 else if (kohde == pelaaja2) 106 { 107 ClearAll(); 108 } 109 } 110 111 112 113 void Liikuta(PlatformCharacter ukko, double nopeus) 114 { 115 ukko.Walk(nopeus); 116 } 117 118 PlatformCharacter LuoUkko(double x, double y, double kokoX, double kokoY) 119 { 120 PlatformCharacter ukko = new PlatformCharacter(kokoX, kokoY, Shapes.Circle); 121 ukko.Mass = 4.0; 122 ukko.X = x; 123 ukko.Y = y; 124 ukko.Image = LoadImage("Tipu1"); 125 Add(ukko); 126 return ukko; 11 127 } 12 128 } -
2010/27/frjolehm/The King of the island/The King of the island/The King of the island.csproj
r1100 r1125 57 57 </PropertyGroup> 58 58 <ItemGroup> 59 <Reference Include="Jypeli2, Version= 1.0.0.0, Culture=neutral, processorArchitecture=x86">59 <Reference Include="Jypeli2, Version=2.3.1.0, Culture=neutral, processorArchitecture=x86"> 60 60 <SpecificVersion>False</SpecificVersion> 61 <HintPath>..\..\ lib\Jypeli2.dll</HintPath>61 <HintPath>..\..\..\lib\Jypeli2.dll</HintPath> 62 62 </Reference> 63 63 <Reference Include="Microsoft.Xna.Framework, Version=3.1.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d" />
Note: See TracChangeset
for help on using the changeset viewer.