Changeset 6310 for 2015


Ignore:
Timestamp:
2015-06-25 08:33:19 (4 years ago)
Author:
empaheik
Message:

Heinähanko + parannusten uudelleenpoimiminen + paranneltu Improvement-luokka tovereineen.

Location:
2015/26/ohjaajat/HillbillyRun/HillbillyRun/HillbillyRun
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • 2015/26/ohjaajat/HillbillyRun/HillbillyRun/HillbillyRun/HillbillyRun/HillbillyRun.cs

    r6307 r6310  
    4343 
    4444    public virtual void DoTheThing() { } 
     45 
     46    public SoundEffect sound; 
    4547} 
    4648 
    47 //Luokka maajussien erikoisuuksille. 
    4849public class MilkImprovement : Improvement 
    4950{ 
    50  
    51  
    5251    public override void DoTheThing() 
    5352    { 
     
    5554        Owner.PlayAnimation(Animations[1]); 
    5655        game.CreateMilkParticles(this.Owner, 10, 200, 300, new Vector(0, -30), "milkparticle"); 
     56        this.sound.Play(); 
    5757 
    5858    } 
    5959 
    6060    public MilkImprovement(double width, double height) 
     61        : base(width, height) 
     62    { 
     63 
     64    } 
     65} 
     66 
     67 
     68public class PitchForkImprovement : Improvement 
     69{ 
     70    public override void DoTheThing() 
     71    { 
     72        HillbillyRun game = this.Game as HillbillyRun; 
     73        Owner.PlayAnimation(Animations[1]); 
     74        //game.CreateMilkParticles(this.Owner, 10, 200, 300, new Vector(0, -30), "milkparticle"); 
     75        //TODO: hitting things w/ pitchfork 
     76 
     77    } 
     78 
     79    public PitchForkImprovement(double width, double height) 
    6180        : base(width, height) 
    6281    { 
     
    94113        improvement.Owner = this; 
    95114 
    96         improvement.Destroy(); 
     115        //improvement.Destroy(); 
    97116    } 
    98117 
     
    102121        { 
    103122            improvement.DoTheThing(); 
     123             
    104124        } 
    105125    } 
     
    153173    private Image cartImage = LoadImage("cart"); 
    154174    private Image milkImage = LoadImage("tonkkaitem"); 
     175    private Image pitchforkImage = LoadImage("fork"); 
    155176 
    156177    private Image cartWheelImage = LoadImage("cartwheel"); 
     
    400421        level.SetTileMethod(Color.Harlequin, CreateCart); 
    401422        level.SetTileMethod(Color.White, CreateBlockObject); 
     423        //level.SetTileMethod(Color.DarkGray, (new AbstractTileMap<Color>.TileMethod[] { CreateMilk, CreatePitchfork })[levelNumber]);  // Vain jos jaksan vippastaa maitokannun pysymään mukana ClearAllin läpi hmm 
    402424        level.SetTileMethod(Color.DarkGray, CreateMilk); 
     425        level.SetTileMethod(Color.FromHexCode("A17FFF"), CreatePitchfork); 
     426 
    403427        level.SetTileMethod(Color.Gray, (new AbstractTileMap<Color>.TileMethod[] { CreateCrawly, CreateWorm })[levelNumber]); // ಠ_ಠ 
    404428        level.SetTileMethod(Color.Red, CreateFireMage); 
     
    407431        //level.SetTileMethod(Color.Orange, CreateDummy, Color.Orange); //TODO: CreateTombstone 
    408432 
    409         level.SetTileMethod(Color.FromHexCode("FF6A00"), CreateTreeTrunk); 
     433        level.SetTileMethod(Color.FromHexCode("FF6A00"), CreateTreeTrunk);  //Pihhh jostain heksoista. Ikävästi haisee luovuttamiselta! :----D 
    410434        level.SetTileMethod(Color.FromHexCode("57007F"), CreateTreeRoot); 
    411435        level.SetTileMethod(Color.FromHexCode("00FF21"), CreateTreeBranch); 
     
    414438 
    415439        level.Execute(TILE_SIZE, TILE_SIZE); 
     440    } 
     441 
     442    void CreatePitchfork(Vector position, double width, double height) 
     443    { 
     444        double size = 30; 
     445        double ratio = pitchforkImage.Width / pitchforkImage.Height; 
     446 
     447        Improvement fork = new PitchForkImprovement(size * ratio, size); 
     448        fork.Image = pitchforkImage; 
     449        fork.Animations = new List<Animation> { pitchforkWalk, pitchforkAttack }; 
     450        fork.Position = position; 
     451        fork.Tag = "improvement"; 
     452        Add(fork); 
     453 
    416454    } 
    417455 
     
    507545        milk.Animations = new List<Animation> { milkWalk, milkThrow }; 
    508546        milk.Position = position; 
    509         milk.Tag = "milk"; 
     547        //milk.Tag = "milk"; 
     548        milk.Tag = "improvement"; 
     549        milk.sound = splash; 
    510550        Add(milk); 
    511551 
     
    770810                if (player.Improvement != null) 
    771811                { 
    772                     Improvement parannus = new MilkImprovement(player.Improvement.Width, player.Improvement.Height); 
    773                     parannus.Image = player.Improvement.Image; 
     812                    Improvement parannus = player.Improvement; 
     813                    //parannus.Image = player.Improvement.Image; 
    774814                    parannus.Position = player.Position; 
    775                     parannus.Animations = player.Improvement.Animations; 
    776                     parannus.Tag = player.Improvement.Tag; 
    777                     parannus.Size = new Vector(60, 60); 
    778                     Add(parannus); 
     815                    parannus.IsVisible = true; 
     816                    parannus.IgnoresCollisionResponse = false; 
     817                    parannus.Tag = "improvement"; 
     818                    //parannus.Animations = player.Improvement.Animations; 
     819                    //parannus.Tag = player.Improvement.Tag; 
     820                    //parannus.Size = new Vector(60, 60); 
     821                    //Add(parannus); 
    779822                } 
    780823 
     
    785828        }; 
    786829 
    787         AddCollisionHandler(player, "milk", CollectMilk); 
    788     } 
     830        AddCollisionHandler(player, "improvement", CollectImprovement); 
     831       // AddCollisionHandler(player, "improvement", CollectImprovement); 
     832    } 
     833 
     834    //void CollectImprovement(PhysicsObject player, PhysicsObject fork) 
     835    //{ 
     836    //    //TODO: Collecting the fork 
     837    //    HillBilly billy = player as HillBilly; 
     838    //    if (billy == null) 
     839    //        return; 
     840 
     841    //    Improvement forkI = fork as Improvement; 
     842    //    billy.GainImprovement(forkI); 
     843 
     844    //    Remove(fork); 
     845    //} 
    789846 
    790847    void CreateGroundTop(Vector position, double width, double height) 
     
    848905    public void CreateMilkParticles(HillBilly billy, int size, int xBase, int yBase, Vector position, String tag) 
    849906    { 
    850         splash.Play(); 
     907        //splash.Play(); 
    851908        for (int i = 0; i < 10; i++) 
    852909        { 
     
    881938        if (player.Improvement == null) 
    882939        { 
     940             
    883941            CreateMilkParticles(player, 5, 100, 100, new Vector(0, player.Height/3), "tears"); 
    884942            return; 
     
    894952    } 
    895953 
    896     void CollectMilk(PhysicsObject player, PhysicsObject milk) 
     954    void CollectImprovement(PhysicsObject player, PhysicsObject milk) 
    897955    { 
    898956        HillBilly billy = player as HillBilly; 
     
    903961        billy.GainImprovement(milkI); 
    904962 
    905         Remove(milk); 
     963        milk.IsVisible = false; 
     964        milk.IgnoresCollisionResponse = true; 
     965        milk.Tag = "none"; 
     966 
     967        //Remove(milk); 
    906968        //billy.AnimWalk = new Animation(milkWalk); 
    907969        //billy.AnimIdle = new Animation(milkWalk.CurrentFrame); 
  • 2015/26/ohjaajat/HillbillyRun/HillbillyRun/HillbillyRun/HillbillyRunContent/HillbillyRunContent.contentproj

    r6303 r6310  
    309309    </Compile> 
    310310  </ItemGroup> 
     311  <ItemGroup> 
     312    <Compile Include="fork.png"> 
     313      <Name>fork</Name> 
     314      <Importer>TextureImporter</Importer> 
     315      <Processor>TextureProcessor</Processor> 
     316    </Compile> 
     317  </ItemGroup> 
    311318  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    312319  <!--  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.