- Timestamp:
- 2010-07-08 14:58:29 (13 years ago)
- Location:
- 2010/27/heikriin
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/27/heikriin/CrabsAndShrimps
-
Property
svn:ignore
set to
paistinpannu%20kuumana.jpg
-
Property
svn:ignore
set to
-
2010/27/heikriin/CrabsAndShrimps/Content/Content.contentproj
r1152 r1203 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>695befa7-ead2-4032-9be5-de8f56484d50</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="paistinpannukuumana2.PNG"> 38 <Name>paistinpannukuumana2</Name> 39 <Importer>TextureImporter</Importer> 40 <Processor>TextureProcessor</Processor> 41 </Compile> 42 </ItemGroup> 36 43 </Project> -
2010/27/heikriin/CrabsAndShrimps/CrabsAndShrimps.csproj
r1152 r1203 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.2.3.0, Culture=neutral, processorArchitecture=x86"> 60 60 <SpecificVersion>False</SpecificVersion> 61 61 <HintPath>..\..\lib\Jypeli2.dll</HintPath> -
2010/27/heikriin/CrabsAndShrimps/Peli.cs
r1152 r1203 10 10 PlatformCharacter katkis; 11 11 PlatformCharacter rapu; 12 GameObject pannu; 13 GameObject kukka; 14 15 IntMeter pisteLaskuri; 16 IntMeter katkisElamat, rapuElamat; 17 18 12 19 13 20 protected override void Begin() … … 15 22 AloitaPeli(); 16 23 luoKentta(); 17 LisaaLaskurit(); 18 24 19 25 katkis = new PlatformCharacter(220.0, 220.0); 20 26 Add(katkis); 21 katkis.Mass = 4.0;27 katkis.Mass = 3.0; 22 28 katkis.X = 380.0; 23 29 katkis.Y = -250.0; 30 31 //pannu = new GameObject(500, 500); 32 //pannu.Color = Color.Red; 33 //pannu.Tag = "pannu"; 34 //Add(pannu); 35 //katkis.Add(pannu); 24 36 25 37 rapu = new PlatformCharacter(300.0, 300.0); … … 28 40 rapu.X = -380.0; 29 41 rapu.Y = -200.0; 42 43 //kukka = new GameObject(500, 500); 44 //kukka.Color = Color.Red; 45 //rapu.Add(kukka); 46 47 AddCollisionHandler(katkis, katkisTormaa); 48 AddCollisionHandler(rapu, rapuTormaa); 30 49 31 50 Level.CreateBorders(false); … … 36 55 Gravity = new Vector(0.0, -800.0); 37 56 lisaaNappaimet(); 57 LuoLaskuri(); 38 58 } 39 59 … … 46 66 Keyboard.Listen(Key.Right, ButtonState.Down, liikuta, "Liikkuu oikealle", katkis, 100.0); 47 67 Keyboard.Listen(Key.Up, ButtonState.Pressed, hyppaa, "Hyppää", katkis, hyppyVoima); 48 Keyboard.Listen(Key.M, ButtonState.Pressed, katkisiskee, "Paistinpannu" , katkis, 100.0);68 Keyboard.Listen(Key.M, ButtonState.Pressed, katkisiskee, "Paistinpannu"); 49 69 50 70 Keyboard.Listen(Key.A, ButtonState.Down, liikuta, "Liikkuu vasemmalle", rapu, -100.0); 51 71 Keyboard.Listen(Key.D, ButtonState.Down, liikuta, "Liikkuu oikealle", rapu, 100.0); 52 72 Keyboard.Listen(Key.W, ButtonState.Pressed, hyppaa, "Hyppää", rapu, hyppyVoima); 73 Keyboard.Listen(Key.Q, ButtonState.Pressed, rapuiskee, "Kukka"); 74 } 75 76 void katkisiskee() 77 { 78 if(katkis.X - rapu.X < 300) 79 { 80 rapuElamat.Value -=3; 81 } 82 } 83 84 void rapuiskee() 85 { 86 if(rapu.X - katkis.X < 300) 87 { 88 katkisElamat.Value -=3; 89 } 90 91 if (katkisElamat.Value <= 0) 92 { 93 MessageDisplay.Add("RAPU VOITTI."); 94 } 95 53 96 } 54 97 … … 66 109 { 67 110 Level.CreateBorders(); 68 Level.Background. CreateGradient(Color.White, Color.SkyBlue);111 Level.Background.Image = LoadImage("paistinpannukuumana2"); 69 112 } 113 114 void katkisTormaa(PhysicsObject katkis, PhysicsObject kohde) 115 { 116 //if (kohde.Tag.ToString() == "pannu") 117 //{ 118 // MessageDisplay.Add("katkikseen osui"); 119 //} 120 } 121 122 void rapuTormaa(PhysicsObject rapu, PhysicsObject kohde) 123 { 124 125 } 126 void LuoLaskuri() 127 { 128 pisteLaskuri = new IntMeter(100); 129 130 katkisElamat = new IntMeter(100); 131 rapuElamat = new IntMeter(100); 132 133 Label katkisNaytto = new Label(100.0, 60.0); 134 katkisNaytto.X = Screen.Right - 100; 135 katkisNaytto.Y = Screen.Top - 50; 136 katkisNaytto.TextColor = Color.White; 137 katkisNaytto.Color = Color.Black; 138 139 katkisNaytto.BindTo(katkisElamat); 140 Add(katkisNaytto); 141 142 Label rapuNaytto = new Label(100.0, 60.0); 143 rapuNaytto.X = Screen.Left + 100; 144 rapuNaytto.Y = Screen.Top - 50; 145 rapuNaytto.TextColor = Color.White; 146 rapuNaytto.Color = Color.Black; 147 148 rapuNaytto.BindTo(rapuElamat); 149 Add(rapuNaytto); 150 151 } 152 153 70 154 71 155 void AloitaPeli() 72 156 { } 73 157 74 void LisaaLaskurit() 75 { 76 LuoPisteLaskuri(Screen.Left + 100.0, Screen.Top - 100.0); 77 LuoPisteLaskuri(Screen.Right - 100.0, Screen.Top - 100.0); 158 78 159 79 }80 160 81 IntMeter LuoPisteLaskuri(double x, double y)82 {83 IntMeter laskuri = new IntMeter(0);84 laskuri.MaxValue = 10;85 Label naytto = new Label();86 naytto.BindTo(laskuri);87 naytto.X = x;88 naytto.Y = y;89 naytto.TextColor = Color.White;90 Add(naytto);91 return laskuri;92 }93 94 void katkisiskee(PlatformCharacter katkis, PlatformCharacter rapu)95 {96 if (katkis == rapu)97 {98 katkis.Value -= 1;99 }100 else if (rapu == katkis)101 {102 rapu.Value -= 1;103 }104 }105 161 106 162
Note: See TracChangeset
for help on using the changeset viewer.