- Timestamp:
- 2015-06-30 22:57:22 (8 years ago)
- Location:
- 2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabriel/Item.cs
r6630 r6631 4 4 using System.Text; 5 5 using Jypeli; 6 using Jypeli.Assets; 6 7 7 8 … … 194 195 { 195 196 // Pistoolilla voi ampua vain jos tähtäysanimaatio on ehtinyt loppuun. 196 if ( player.Animation.CurrentFrameIndex == player.Animation.FrameCount - 1)197 if (InUse && Usages.Value > 0 && player.Animation.CurrentFrameIndex == player.Animation.FrameCount - 1) 197 198 { 198 199 Usages.Value--; … … 200 201 201 202 var bullet = new PhysicsObject(4, 4); 203 bullet.Image = TheLegendOfGabriel.BulletImage; 202 204 bullet.Position = player.Position + ShootDirection.GetVector() * player.Width * 0.7; 203 205 bullet.Hit(ShootDirection.GetVector() * 500); … … 219 221 } 220 222 223 class Grenade : Item 224 { 225 public Grenade(Player player) : base(player) 226 { 227 Usages.MaxValue = 15; 228 Usages.Value = 15; 229 InventoryImage = TheLegendOfGabriel.GrenadeImage; 230 } 231 232 public override void UseKeyPressed() 233 { 234 if (Usages.Value > 0) 235 { 236 Usages.Value--; 237 238 var grenade = new PhysicsObject(6, 6); 239 grenade.Image = TheLegendOfGabriel.GrenadeSmallImage; 240 grenade.Position = player.Position + player.LastDirection.GetVector() * player.Width * 0.7; 241 grenade.Hit(player.LastDirection.GetVector() * 500); 242 grenade.ApplyTorque(9000); 243 grenade.LinearDamping = 0.9; 244 grenade.AngularDamping = 0.9; 245 Game.Instance.Add(grenade); 246 247 Timer.SingleShot(1.5, delegate 248 { 249 var expl = new Explosion(50); 250 expl.Position = grenade.Position; 251 Game.Instance.Add(expl); 252 grenade.Destroy(); 253 }); 254 } 255 base.UseKeyPressed(); 256 } 257 } 258 221 259 class Monocle : Item 222 260 { -
2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabriel/LevelCreation.cs
r6626 r6631 66 66 player.Inventory.Add(new Pistol(player)); 67 67 player.Inventory.Add(new Monocle(player)); 68 player.Inventory.Add(new Grenade(player)); 68 69 69 70 AddCollisionHandler(player, "exit", CollidesWithExit); -
2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabriel.cs
r6630 r6631 86 86 87 87 public static Image GunImage = LoadImage("gun"); 88 public static Image BulletImage = LoadImage("bullet"); 88 89 public static Image LetterImage = LoadImage("letter"); 89 90 public static Image SmallSwordImage = LoadImage("smallsword"); … … 91 92 public static Image BigMonocleImage = LoadImage("bigmonocle"); 92 93 public static Image BigSwordImage = LoadImage("bigsword"); 94 public static Image GrenadeImage = LoadImage("gran"); 95 public static Image GrenadeSmallImage = LoadImage("gransmall"); 93 96 94 97 public static Image FrameImage = LoadImage("frame"); … … 282 285 //CreatePlayer(new Vector(-Level.Width/3, Level.Bottom + TILE_SIZE * 2)); 283 286 SetControls(); 284 Camera.ZoomToLevel(); 287 //Camera.ZoomToLevel(); 288 Camera.Follow(player); 289 Camera.ZoomFactor = 2.0; 285 290 } 286 291 -
2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabrielContent/TheLegendOfGabrielContent.contentproj
r6630 r6631 243 243 </Compile> 244 244 </ItemGroup> 245 <ItemGroup> 246 <Compile Include="bullet.png"> 247 <Name>bullet</Name> 248 <Importer>TextureImporter</Importer> 249 <Processor>TextureProcessor</Processor> 250 </Compile> 251 </ItemGroup> 252 <ItemGroup> 253 <Compile Include="gransmall.png"> 254 <Name>gransmall</Name> 255 <Importer>TextureImporter</Importer> 256 <Processor>TextureProcessor</Processor> 257 </Compile> 258 </ItemGroup> 245 259 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 246 260 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Note: See TracChangeset
for help on using the changeset viewer.