Changeset 6631 for 2015/27/ohjaajat


Ignore:
Timestamp:
2015-06-30 22:57:22 (4 years ago)
Author:
sieerinn
Message:

Miekan ääntä säädetty hiljaisemmaksi. Kranaatteja voi heitellä.

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  
    44using System.Text; 
    55using Jypeli; 
     6using Jypeli.Assets; 
    67 
    78 
     
    194195    { 
    195196        // 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) 
    197198        { 
    198199            Usages.Value--; 
     
    200201 
    201202            var bullet = new PhysicsObject(4, 4); 
     203            bullet.Image = TheLegendOfGabriel.BulletImage; 
    202204            bullet.Position = player.Position + ShootDirection.GetVector() * player.Width * 0.7; 
    203205            bullet.Hit(ShootDirection.GetVector() * 500); 
     
    219221} 
    220222 
     223class 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 
    221259class Monocle : Item 
    222260{ 
  • 2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabriel/LevelCreation.cs

    r6626 r6631  
    6666        player.Inventory.Add(new Pistol(player)); 
    6767        player.Inventory.Add(new Monocle(player)); 
     68        player.Inventory.Add(new Grenade(player)); 
    6869 
    6970        AddCollisionHandler(player, "exit", CollidesWithExit); 
  • 2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabriel.cs

    r6630 r6631  
    8686 
    8787    public static Image GunImage = LoadImage("gun"); 
     88    public static Image BulletImage = LoadImage("bullet"); 
    8889    public static Image LetterImage = LoadImage("letter"); 
    8990    public static Image SmallSwordImage = LoadImage("smallsword"); 
     
    9192    public static Image BigMonocleImage = LoadImage("bigmonocle"); 
    9293    public static Image BigSwordImage = LoadImage("bigsword"); 
     94    public static Image GrenadeImage = LoadImage("gran"); 
     95    public static Image GrenadeSmallImage = LoadImage("gransmall"); 
    9396 
    9497    public static Image FrameImage = LoadImage("frame"); 
     
    282285        //CreatePlayer(new Vector(-Level.Width/3, Level.Bottom + TILE_SIZE * 2)); 
    283286        SetControls(); 
    284         Camera.ZoomToLevel(); 
     287        //Camera.ZoomToLevel(); 
     288        Camera.Follow(player); 
     289        Camera.ZoomFactor = 2.0; 
    285290    } 
    286291 
  • 2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabrielContent/TheLegendOfGabrielContent.contentproj

    r6630 r6631  
    243243    </Compile> 
    244244  </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> 
    245259  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    246260  <!--  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.