Changeset 6617 for 2015


Ignore:
Timestamp:
2015-06-30 16:47:41 (8 years ago)
Author:
sieerinn
Message:

Tähtäysanimaatiot ja inventory äheltämistä.

Location:
2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel
Files:
27 added
5 edited

Legend:

Unmodified
Added
Removed
  • 2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabriel/Item.cs

    r6550 r6617  
    5353        : base(player) 
    5454    { 
     55        InventoryImage = TheLegendOfGabriel.SmallSwordImage; 
    5556        swordAngles = new Angle[5]; 
    5657        for (var i = 0; i < 5; i++) 
     
    125126    { 
    126127        Charge = new DoubleMeter(0, 0, 4); 
     128        InventoryImage = TheLegendOfGabriel.GunImage; 
    127129    } 
    128130 
     
    145147        player.MovementSpeed.Value = player.MovementSpeed.MaxValue * 0.333; 
    146148 
    147         // TODO: Tee pistoolin ampumiselle animaatio. 
    148149        ShootDirection = player.Velocity.Angle.MainDirection; 
    149         player.Animation = new Animation(player.SwingAnimations[ShootDirection]); 
     150        player.Animation = new Animation(player.ShootAnimations[ShootDirection]); 
    150151        player.Animation.StopOnLastFrame = true; 
    151152        player.Animation.Start(1); 
     
    172173    } 
    173174} 
     175 
     176class Monocle : Item 
     177{ 
     178    public Monocle(Player player) : base(player) 
     179    { 
     180    } 
     181 
     182    public override void UpdateItem(Time time) 
     183    { 
     184        base.UpdateItem(time); 
     185    } 
     186 
     187    public override void UseKeyReleased() 
     188    { 
     189        InUse = true; 
     190        base.UseKeyReleased(); 
     191    } 
     192 
     193    public override void UseKeyPressed() 
     194    { 
     195        InUse = false; 
     196        base.UseKeyPressed(); 
     197    } 
     198} 
  • 2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabriel/LevelCreation.cs

    r6550 r6617  
    5151        player.SwingAnimations[Direction.Up] = playerSwingUp; 
    5252        player.SwingAnimations[Direction.Down] = playerSwingDown; 
     53        player.ShootAnimations[Direction.Left] = playerShootLeft; 
     54        player.ShootAnimations[Direction.Right] = playerShootRight; 
     55        player.ShootAnimations[Direction.Up] = playerShootUp; 
     56        player.ShootAnimations[Direction.Down] = playerShootDown; 
    5357        player.Image = playerWalkDown.CurrentFrame; 
    5458        Add(player, 1); 
    5559 
    56         player.ActiveItem = new Sword(player); 
    57         //player.ActiveItem = new Pistol(player); 
     60        player.Sword = new Sword(player); 
     61        player.Inventory.Add(new Pistol(player)); 
    5862 
    5963 
  • 2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabriel/Player.cs

    r6549 r6617  
    66    public Dictionary<Direction, Animation> SwingAnimations { get; set; } 
    77 
    8     public Item ActiveItem { get; set; } 
     8    public Dictionary<Direction, Animation> ShootAnimations { get; set; } 
     9 
     10    public Item Sword { get; set; } 
     11 
     12    public Item ActiveItem 
     13    { 
     14        get 
     15        { 
     16            if (activeItemIndex < Inventory.Count) 
     17            { 
     18                return Inventory[activeItemIndex]; 
     19            } 
     20            return null; 
     21        } 
     22    } 
     23 
     24    private int activeItemIndex = 0; 
     25 
     26    public List<Item> Inventory { get; private set; } 
    927 
    1028    public Player() 
    1129        : base(TheLegendOfGabriel.TILE_SIZE, TheLegendOfGabriel.TILE_SIZE) 
    1230    { 
     31        Inventory = new List<Item>(); 
    1332        SwingAnimations = new Dictionary<Direction, Animation>(); 
     33        ShootAnimations = new Dictionary<Direction, Animation>(); 
    1434        CollisionIgnoreGroup = 1; 
     35    } 
     36 
     37    public void CycleItems() 
     38    { 
     39        activeItemIndex++; 
     40        if (activeItemIndex >= Inventory.Count) 
     41        { 
     42            activeItemIndex = 0; 
     43        } 
    1544    } 
    1645 
  • 2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabriel.cs

    r6616 r6617  
    4949    [AssetName("swingdown")] 
    5050    private Animation playerSwingDown; 
     51 
     52    [AssetName("shootup")] 
     53    private Animation playerShootUp; 
     54    [AssetName("shootright")] 
     55    private Animation playerShootRight; 
     56    [AssetName("shootright", mirror: true)] 
     57    private Animation playerShootLeft; 
     58    [AssetName("shootdown")] 
     59    private Animation playerShootDown; 
    5160 
    5261    #endregion 
  • 2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabrielContent/TheLegendOfGabrielContent.contentproj

    r6549 r6617  
    155155    </Compile> 
    156156  </ItemGroup> 
     157  <ItemGroup> 
     158    <Compile Include="shootdown.anim"> 
     159      <Name>shootdown</Name> 
     160      <Importer>AnimationImporter</Importer> 
     161      <Processor>AnimationContentProcessor</Processor> 
     162    </Compile> 
     163    <Compile Include="shootright.anim"> 
     164      <Name>shootright</Name> 
     165      <Importer>AnimationImporter</Importer> 
     166      <Processor>AnimationContentProcessor</Processor> 
     167    </Compile> 
     168    <Compile Include="shootup.anim"> 
     169      <Name>shootup</Name> 
     170      <Importer>AnimationImporter</Importer> 
     171      <Processor>AnimationContentProcessor</Processor> 
     172    </Compile> 
     173  </ItemGroup> 
    157174  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    158175  <!--  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.