Changeset 6297 for 2015/26/ohjaajat


Ignore:
Timestamp:
2015-06-24 22:56:25 (4 years ago)
Author:
sieerinn
Message:

Metsän metsämäistämisprosessi vaiheessa.

Location:
2015/26/ohjaajat/HillbillyRun/HillbillyRun/HillbillyRun
Files:
17 added
2 edited

Legend:

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

    r6295 r6297  
    5555        Owner.PlayAnimation(Animations[1]); 
    5656        game.CreateMilkParticles(this.Owner, 10, 200, 300, new Vector(0, -30), "milkparticle"); 
    57          
     57 
    5858    } 
    5959 
     
    101101        if (Animation != improvement.Animations[1]) 
    102102        { 
    103              improvement.DoTheThing(); 
     103            improvement.DoTheThing(); 
    104104        } 
    105105    } 
     
    144144 
    145145    # region Images 
    146     private Image[] groundImages = LoadImages("ground", "ground");    //Näitä ei tosin kaikkia kenties jaksa tehdä erilaisiksi levelistä riippuen 
    147     private Image[] groundTopImages = LoadImages("ground_top", "ground_top"); 
     146    private Image[] groundImages = LoadImages("ground", "ground_forest");    //Näitä ei tosin kaikkia kenties jaksa tehdä erilaisiksi levelistä riippuen 
     147    private Image[] groundTopImages = LoadImages("ground_top", "ground_top_forest"); 
    148148    private Image[] foregroundDecorations = LoadImages("viljaa", "grass"); 
    149     private Image[] blockImages = LoadImages("box2", "box"); 
     149    private Image[] blockImages = LoadImages("box2", "rock"); 
    150150 
    151151    private Image[] houseImages = LoadImages("house", "houseburned"); 
     
    159159    private Image smokeImage2 = LoadImage("smoke2"); 
    160160 
     161    private Image treeTrunkImage = LoadImage("bigtree"); 
     162    private Image treeBottomImage = LoadImage("bigtree3x2"); 
     163    private Image treeBranchImage = LoadImage("bigtreebranch"); 
    161164    private Image forestBackgroundImage = LoadImage("forestbackground"); 
    162165 
     
    174177    private Animation firemageAnimation; 
    175178    private Animation firemageCastAnimation; 
     179    private Animation wormAnimation; 
    176180    #endregion 
    177181 
     
    336340        firemageAnimation = LoadAnimation("firemage"); 
    337341        firemageCastAnimation = LoadAnimation("firemagecast"); 
     342        wormAnimation = LoadAnimation("worm"); 
    338343 
    339344        cameraOffset = Window.Width / 4; 
     
    362367        Add(forestBackground, -3); 
    363368        Layers[-3].RelativeTransition = new Vector(0.5, 1.0); 
    364         Level.Background.CreateGradient(Color.Black, Color.SkyBlue); 
     369 
     370        if (levelNumber == 1) 
     371        { 
     372            Level.Background.CreateGradient(Color.Black, Color.FromHexCode("495147")); 
     373        } 
     374        else 
     375        { 
     376            Level.Background.CreateGradient(Color.Black, Color.SkyBlue); 
     377        } 
    365378    } 
    366379 
     
    384397        level.SetTileMethod(Color.White, CreateBlockObject); 
    385398        level.SetTileMethod(Color.DarkGray, CreateMilk); 
    386         level.SetTileMethod(Color.Gray, CreateCrawly); 
     399        level.SetTileMethod(Color.Gray, (new AbstractTileMap<Color>.TileMethod[] { CreateCrawly, CreateWorm })[levelNumber]); // ಠ_ಠ 
    387400        level.SetTileMethod(Color.Red, CreateFireMage); 
    388401        level.SetTileMethod(Color.Rose, CreateFlame, true); 
    389402        //level.SetTileMethod(Color.Azure, CreateDummy, Color.Azure);   //TODO: CreateSmoke 
    390403        //level.SetTileMethod(Color.Orange, CreateDummy, Color.Orange); //TODO: CreateTombstone 
     404 
     405        level.SetTileMethod(Color.FromHexCode("FF6A00"), CreateTreeTrunk); 
     406        level.SetTileMethod(Color.FromHexCode("57007F"), CreateTreeRoot); 
     407        level.SetTileMethod(Color.FromHexCode("00FF21"), CreateTreeBranch); 
     408 
    391409        level.Optimize(Color.Brown);    //Color.Black   //Tekee jännittäviä asioita wheatille, jos optimoidaan (tietysti). Jotenn.  
     410 
    392411        level.Execute(TILE_SIZE, TILE_SIZE); 
     412    } 
     413 
     414    void CreateTreeBranch(Vector position, double width, double height) 
     415    { 
     416        PhysicsObject branch = PhysicsObject.CreateStaticObject(width, height); 
     417        branch.Position = position; 
     418        branch.Image = treeBranchImage; 
     419        Add(branch, -1); 
     420    } 
     421 
     422    void CreateTreeTrunk(Vector position, double width, double height) 
     423    { 
     424        GameObject trunk = new GameObject(width * 3, height); 
     425        trunk.Position = position; 
     426        trunk.Image = treeTrunkImage; 
     427        Add(trunk, -1); 
     428    } 
     429 
     430    void CreateTreeRoot(Vector position, double width, double height) 
     431    { 
     432        GameObject roots = new GameObject(width * 9, height * 4); 
     433        roots.Position = position; 
     434        roots.Y -= height; 
     435        roots.Image = treeBottomImage; 
     436        Add(roots, -1); 
    393437    } 
    394438 
     
    429473            flame.Destroy(); 
    430474            savu.Destroy(); 
    431              
     475 
    432476        }); 
    433477    } 
     
    467511        //milk.Tag = "milk"; 
    468512        //Add(milk); 
     513    } 
     514 
     515    void CreateWorm(Vector position, double width, double height) 
     516    { 
     517        PlatformCharacter worm = new PlatformCharacter(width, height * 0.6); 
     518        worm.Position = position; 
     519        worm.Animation = new Animation(wormAnimation); 
     520        worm.Animation.FPS = RandomGen.NextInt(18, 24); 
     521        worm.Animation.Step(RandomGen.NextInt(0, 16)); 
     522        worm.Animation.Resume(); 
     523        worm.Tag = "worm"; 
     524        worm.CollisionIgnoreGroup = 3; 
     525        Add(worm, 1); 
     526 
     527        PlatformWandererBrain brain = new PlatformWandererBrain(); 
     528        brain.Speed = 60; 
     529        brain.FallsOffPlatforms = true; 
     530        worm.Brain = brain; 
    469531    } 
    470532 
     
    555617            mage.PlayAnimation(firemageCastAnimation); 
    556618 
    557             Timer.SingleShot(1.5,  
    558                 delegate  
     619            Timer.SingleShot(1.5, 
     620                delegate 
    559621                { 
    560622                    for (int i = 0; i < 6; i++) 
     
    580642                    } 
    581643                }); 
    582              
     644 
    583645        }; 
    584646        //castTimer.Start(); 
     
    601663        }); 
    602664 
    603         AddCollisionHandler(trigger, "player", delegate(PhysicsObject a, PhysicsObject b){ castTimer.Start(); }); 
     665        AddCollisionHandler(trigger, "player", delegate(PhysicsObject a, PhysicsObject b) { castTimer.Start(); }); 
    604666    } 
    605667 
     
    672734        player.Tag = "player"; 
    673735        Add(player); 
     736 
    674737        AddCollisionHandler(player, "burn", delegate(PhysicsObject p, PhysicsObject t) 
    675738        { 
    676             HillBilly billy = p as HillBilly; 
    677             billy.Life.Value--; 
    678  
     739            player.Life.Value--; 
    679740        }); 
     741 
     742        AddCollisionHandler(player, "worm", delegate(PhysicsObject p, PhysicsObject worm) 
     743        { 
     744            if (player.Y > worm.Y && Math.Abs(player.X - worm.X) < worm.Width / 2.0) 
     745            { 
     746                worm.Destroy(); 
     747            } 
     748            else 
     749            { 
     750                player.Life.Value--; 
     751            } 
     752        }); 
     753 
    680754 
    681755        player.Life.LowerLimit += delegate 
     
    685759                Loss(); 
    686760            } 
    687             else  
    688             {  
     761            else 
     762            { 
    689763                players.Remove(player); 
    690764 
     
    694768                    parannus.Image = player.Improvement.Image; 
    695769                    parannus.Position = player.Position; 
    696                     parannus.Animations = player.Improvement.Animations;  
     770                    parannus.Animations = player.Improvement.Animations; 
    697771                    parannus.Tag = player.Improvement.Tag; 
    698772                    parannus.Size = new Vector(60, 60); 
     
    701775 
    702776                player.Destroy(); 
    703                  
    704                  
     777 
     778 
    705779            } 
    706780        }; 
     
    719793        // Maanpinnan näkyvä osa. 
    720794        GameObject visibleGround = new GameObject(width, height); 
    721         visibleGround.Image = groundImages[levelNumber]; 
     795        visibleGround.Image = groundTopImages[levelNumber]; 
    722796        visibleGround.Position = position; 
    723797        visibleGround.TextureWrapSize = new Vector(width / TILE_SIZE, height / TILE_SIZE); 
     
    730804        { 
    731805            GameObject wheatBlock = new GameObject(width * 1.5, height * 2); 
    732             wheatBlock.Image = foregroundDecorations[0]; 
     806            wheatBlock.Image = foregroundDecorations[levelNumber]; 
    733807            wheatBlock.X = visibleGround.X; 
    734808            wheatBlock.Bottom = visibleGround.Bottom; 
     
    741815    { 
    742816        PhysicsObject ground = PhysicsObject.CreateStaticObject(width, height); 
    743         ground.Image = groundTopImages[levelNumber]; 
     817        ground.Image = groundImages[levelNumber]; 
    744818        ground.Position = position; 
    745819        ground.TextureWrapSize = new Vector(width / TILE_SIZE, height / TILE_SIZE); 
    746         Add(ground); 
     820        Add(ground, -1); 
    747821    } 
    748822    #endregion 
  • 2015/26/ohjaajat/HillbillyRun/HillbillyRun/HillbillyRun/HillbillyRunContent/HillbillyRunContent.contentproj

    r6288 r6297  
    247247    </Compile> 
    248248  </ItemGroup> 
     249  <ItemGroup> 
     250    <Compile Include="rock.png"> 
     251      <Name>rock</Name> 
     252      <Importer>TextureImporter</Importer> 
     253      <Processor>TextureProcessor</Processor> 
     254    </Compile> 
     255    <Compile Include="spikes.png"> 
     256      <Name>spikes</Name> 
     257      <Importer>TextureImporter</Importer> 
     258      <Processor>TextureProcessor</Processor> 
     259    </Compile> 
     260  </ItemGroup> 
     261  <ItemGroup> 
     262    <Compile Include="worm.anim"> 
     263      <Name>worm</Name> 
     264      <Importer>AnimationImporter</Importer> 
     265      <Processor>AnimationContentProcessor</Processor> 
     266    </Compile> 
     267  </ItemGroup> 
     268  <ItemGroup> 
     269    <Compile Include="bigtree.png"> 
     270      <Name>bigtree</Name> 
     271      <Importer>TextureImporter</Importer> 
     272      <Processor>TextureProcessor</Processor> 
     273    </Compile> 
     274    <Compile Include="bigtree3x2.png"> 
     275      <Name>bigtree3x2</Name> 
     276      <Importer>TextureImporter</Importer> 
     277      <Processor>TextureProcessor</Processor> 
     278    </Compile> 
     279    <Compile Include="bigtreebranch.png"> 
     280      <Name>bigtreebranch</Name> 
     281      <Importer>TextureImporter</Importer> 
     282      <Processor>TextureProcessor</Processor> 
     283    </Compile> 
     284  </ItemGroup> 
     285  <ItemGroup> 
     286    <Compile Include="ground_forest.png"> 
     287      <Name>ground_forest</Name> 
     288      <Importer>TextureImporter</Importer> 
     289      <Processor>TextureProcessor</Processor> 
     290    </Compile> 
     291    <Compile Include="ground_top_forest.png"> 
     292      <Name>ground_top_forest</Name> 
     293      <Importer>TextureImporter</Importer> 
     294      <Processor>TextureProcessor</Processor> 
     295    </Compile> 
     296  </ItemGroup> 
    249297  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    250298  <!--  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.