- Timestamp:
- 2010-07-29 14:50:46 (13 years ago)
- Location:
- 2010/27/Aajokahe
- Files:
-
- 14 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/27/Aajokahe/Nurinams adventure/Content/Content.contentproj
r1377 r1406 57 57 <Reference Include="Microsoft.Xna.Framework.Content.Pipeline.XImporter, Version=3.1.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d" /> 58 58 </ItemGroup> 59 <ItemGroup> 60 <Compile Include="Background.png"> 61 <Name>Background</Name> 62 <Importer>TextureImporter</Importer> 63 <Processor>TextureProcessor</Processor> 64 </Compile> 65 </ItemGroup> 66 <ItemGroup> 67 <Compile Include="Nurinam%27s house.png"> 68 <Name>Nurinam%27s house</Name> 69 <Importer>TextureImporter</Importer> 70 <Processor>TextureProcessor</Processor> 71 </Compile> 72 </ItemGroup> 73 <ItemGroup> 74 <Compile Include="Nurinam2.png"> 75 <Name>Nurinam2</Name> 76 <Importer>TextureImporter</Importer> 77 <Processor>TextureProcessor</Processor> 78 </Compile> 79 </ItemGroup> 80 <ItemGroup> 81 <Compile Include="Enemy.png"> 82 <Name>Enemy</Name> 83 <Importer>TextureImporter</Importer> 84 <Processor>TextureProcessor</Processor> 85 </Compile> 86 </ItemGroup> 87 <ItemGroup> 88 <Compile Include="Ak 47.png"> 89 <Name>Ak 47</Name> 90 <Importer>TextureImporter</Importer> 91 <Processor>TextureProcessor</Processor> 92 </Compile> 93 </ItemGroup> 94 <ItemGroup> 95 <Compile Include="Ak-47.png"> 96 <Name>Ak-47</Name> 97 <Importer>TextureImporter</Importer> 98 <Processor>TextureProcessor</Processor> 99 </Compile> 100 </ItemGroup> 101 <ItemGroup> 102 <Compile Include="Ninja Star.png"> 103 <Name>Ninja Star</Name> 104 <Importer>TextureImporter</Importer> 105 <Processor>TextureProcessor</Processor> 106 </Compile> 107 </ItemGroup> 59 108 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 60 109 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2010/27/Aajokahe/Nurinams adventure/Peli.cs
r1377 r1406 3 3 using Jypeli.Widgets; 4 4 using Jypeli.Assets; 5 using Jypeli.Effects; 6 7 5 8 6 9 … … 15 18 16 19 PlatformCharacter pelaaja1; 17 PlatformCharacter vihollinen;20 //PlatformCharacter vihollinen; 18 21 19 22 //pyssy = new AssaultRifle(70, 20); 20 23 24 Image taustaKuva = LoadImage("Background"); 25 26 21 27 protected override void Begin() 22 {28 { 23 29 Gravity = new Vector(0, -1000); 24 30 25 31 luoKentta(); 26 32 lisaaNappaimet(); 27 vihollinen=LuoVihollinen();28 LuoLaskuri( );33 LuoVihollinen(); 34 LuoLaskuri( ); 29 35 LuoHPBar(); 36 LuoAjastin(); 37 AmmuAseella(); 38 Level.Background.Image = taustaKuva; 30 39 31 40 Camera.Follow(pelaaja1); … … 33 42 Camera.StayInLevel = true; 34 43 MessageDisplay.Add("sotalordin miehet ovat löytäneet sinun piilopaikkasi ja rynnivät sitä päin kiväärit tanassa. Sinun täytyy puolustaa piilopaikkaasi."); 44 MessageDisplay.TextColor = Color.Red; 45 46 } 47 48 void LuoAjastin() 49 { 50 Timer ajastin = new Timer(); 51 ajastin.Interval = 5.5; 52 ajastin.Trigger += lisaaVihollisia; 53 Add(ajastin); 54 ajastin.Start(); 35 55 36 56 } … … 55 75 Add(taso); 56 76 taso.Tag = "talo"; 77 taso.Image = LoadImage("Nurinam's house"); 57 78 58 79 } … … 62 83 pelaaja1 = new PlatformCharacter (40, 40); 63 84 pelaaja1.Mass = 4.0; 64 pelaaja1.Image = LoadImage("Nurinam ninja");85 pelaaja1.Image = LoadImage("Nurinam2"); 65 86 pelaaja1.X = -400; 66 87 pelaaja1.Y = -10; 67 88 AddCollisionHandler(pelaaja1 , KasittelePelaaja1Tormays); 89 pelaaja1.Weapon = new AssaultRifle (0.1, 0.1); 90 68 91 Add(pelaaja1); 69 92 … … 81 104 Keyboard.Listen(Key.Right, ButtonState.Down, liikuta, "Liikkuu oikealle", pelaaja1, nopeus); 82 105 Keyboard.Listen(Key.Up, ButtonState.Pressed, hyppaa, "Hyppää", pelaaja1, hyppyVoima); 106 Keyboard.Listen(Key.C, ButtonState.Down, AmmuAseella, "Ammu"); 107 83 108 84 109 ControllerOne.Listen(Button.Back, ButtonState.Pressed, Exit, "Poistu pelistä"); … … 103 128 PlatformCharacter vihollinen = new PlatformCharacter(40, 40); 104 129 vihollinen.Shape = Shapes.Circle; 105 vihollinen.Image = LoadImage(" Warrior");130 vihollinen.Image = LoadImage("Enemy"); 106 131 vihollinen.Mass = 10.0; 107 132 Add(vihollinen); 108 vihollinen.Y = 0;109 vihollinen. X= 300;133 vihollinen.Y = -300; 134 vihollinen. X= +450; 110 135 vihollinen.Tag = "vihollinen"; 111 136 AddCollisionHandler(vihollinen, KasitteleVihollisenTormays); 112 137 113 AssaultRifle pyssy = new AssaultRifle (40, 5); 138 AssaultRifle pyssy = new AssaultRifle (50, 10); 139 pyssy.Image = LoadImage ("Ak-47"); 114 140 vihollinen.Weapon = pyssy ; 115 141 116 142 Timer kavelyajastin = new Timer(); 143 kavelyajastin.Interval = 0.01; 144 kavelyajastin.Trigger += Viholliskavely; 145 kavelyajastin.Tag = vihollinen; 146 kavelyajastin.Start(); 147 Add(kavelyajastin); 117 148 118 149 return vihollinen; 119 150 } 120 151 121 void Ammu( )152 void Ammu(PlatformCharacter vihollinen) 122 153 { 123 154 PhysicsObject ammus = vihollinen.Weapon.Shoot(); … … 129 160 } 130 161 162 void Viholliskavely(Timer ajastin) 163 { 164 PlatformCharacter vihollinen = ((PlatformCharacter)ajastin.Tag); 165 166 vihollinen.Walk(-70); 167 if ((pelaaja1.Y < vihollinen.Y + 10) && (pelaaja1.Y > vihollinen.Y - 10)) 168 { 169 Ammu(vihollinen); 170 } 171 } 172 131 173 protected override void Update(Time time) 132 174 { 133 vihollinen.Walk(-70);134 if ((pelaaja1.Y < vihollinen.Y + 10) && (pelaaja1.Y > vihollinen.Y - 10))135 {136 Ammu();137 }138 175 base.Update(time); 139 140 176 } 141 177 void KasittelePelaaja1Tormays(PhysicsObject pelaaja1, PhysicsObject kohde) … … 151 187 { 152 188 pelaaja1.Destroy(); 189 Exit(); 153 190 154 191 } … … 163 200 pisteNaytto.X = Screen.Left + 100; 164 201 pisteNaytto.Y = Screen.Top - 100; 165 pisteNaytto.TextColor = Color. Black;202 pisteNaytto.TextColor = Color.DarkRed ; 166 203 167 204 pisteNaytto.BindTo(pisteLaskuri); … … 171 208 pisteTeksti.X = Screen.Left + 50; 172 209 pisteTeksti.Y = Screen.Top - 100; 173 pisteTeksti.TextColor = Color. Black;210 pisteTeksti.TextColor = Color.DarkRed; 174 211 Add(pisteTeksti); 175 212 … … 181 218 { 182 219 pisteLaskuri2 = new IntMeter(0); 183 184 220 Label pisteNaytto2 = new Label(); 185 pisteNaytto2.X = Screen.Left +250;186 pisteNaytto2.Y = Screen.Top - 100;187 pisteNaytto2.TextColor = Color. Black;221 pisteNaytto2.X = Screen.Left -700; 222 pisteNaytto2.Y = Screen.Top -700; 223 pisteNaytto2.TextColor = Color.Red; 188 224 189 225 pisteNaytto2.BindTo(pisteLaskuri2); … … 191 227 192 228 Label pisteTeksti2 = new Label("Rakennus: "); 193 pisteTeksti2.X = Screen.Left + 190;194 pisteTeksti2.Y = Screen.Top - 100;195 pisteTeksti2.TextColor = Color. Black;229 pisteTeksti2.X = Screen.Left -700; 230 pisteTeksti2.Y = Screen.Top -700; 231 pisteTeksti2.TextColor = Color.Red; 196 232 Add(pisteTeksti2); 197 233 198 234 199 235 200 voimaMittari = new DoubleMeter( 60);201 voimaMittari.MaxValue = 60;236 voimaMittari = new DoubleMeter(5); 237 voimaMittari.MaxValue = 5; 202 238 BarGauge voimaPalkki = new BarGauge(10, 150); 203 239 voimaPalkki.BindTo(voimaMittari); … … 205 241 voimaPalkki.X = (0.85 * Screen.LeftSafe); 206 242 voimaPalkki.Y = (0.05 * Screen.Height); 207 voimaPalkki.BarColor = Color. Aqua;243 voimaPalkki.BarColor = Color.Red; 208 244 voimaPalkki.BorderColor = Color.Black; 209 245 voimaPalkki.Angle = Angle.Degrees(90); … … 227 263 } 228 264 265 void lisaaVihollisia(Timer sender) 266 { 267 LuoVihollinen(); 268 } 269 void AmmuAseella() 270 { 271 PhysicsObject Ninjatähti = pelaaja1.Weapon.Shoot(); 272 273 if (Ninjatähti != null) 274 { 275 Ninjatähti.Size = new Vector(10, 10); 276 Ninjatähti.Image = LoadImage("Ninja Star"); 277 278 } 279 280 } 281 void KasitteleNinjatahdenTormays(PhysicsObject Ninjatähti, PhysicsObject kohde) 282 { 283 if (kohde.Tag.ToString() == "vihollinen") 284 { 285 kohde.Destroy(); 286 } 287 } 288 289 229 290 }
Note: See TracChangeset
for help on using the changeset viewer.