Changeset 6385 for 2015/26


Ignore:
Timestamp:
2015-06-25 17:39:54 (4 years ago)
Author:
empaheik
Message:

Sienivelhon puolikas.

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

    r6384 r6385  
    433433        level.SetTileMethod(Color.Gold, CreatePlayer); 
    434434        level.SetTileMethod(Color.Harlequin, CreateCart); 
     435        level.SetTileMethod(Color.FromHexCode("A17FFF"), CreatePitchfork); 
     436 
     437        level.SetTileMethod(Color.Gray, (new AbstractTileMap<Color>.TileMethod[] { CreateCrawly, CreateWorm })[levelNumber]); // ಠ_ಠ 
     438        level.SetTileMethod(Color.Red, (new AbstractTileMap<Color>.TileMethod[] { CreateFireMage, CreateShroom })[levelNumber]); 
    435439        level.SetTileMethod(Color.White, CreateBlockObject); 
    436         //level.SetTileMethod(Color.DarkGray, (new AbstractTileMap<Color>.TileMethod[] { CreateMilk, CreatePitchfork })[levelNumber]);  // Vain jos jaksan vippastaa maitokannun pysymään mukana ClearAllin läpi hmm 
    437440        level.SetTileMethod(Color.DarkGray, CreateMilk); 
    438         level.SetTileMethod(Color.FromHexCode("A17FFF"), CreatePitchfork); 
    439  
    440         level.SetTileMethod(Color.Gray, (new AbstractTileMap<Color>.TileMethod[] { CreateCrawly, CreateWorm })[levelNumber]); // ಠ_ಠ 
    441         level.SetTileMethod(Color.Red, CreateFireMage); 
    442441        level.SetTileMethod(Color.Rose, CreateFlame, true); 
    443442        //level.SetTileMethod(Color.Azure, CreateDummy, Color.Azure);   //TODO: CreateSmoke 
     
    623622        brain.Speed = 60; 
    624623        brain.FallsOffPlatforms = false; 
     624        brain.TriesToJump = true; 
    625625        worm.Brain = brain; 
    626626 
     
    672672            RemoveCollisionHandlers(crawly); 
    673673        }); 
     674    } 
     675 
     676    void CreateShroom(Vector position, double width, double height) 
     677    { 
     678        PlatformCharacter shroom = new PlatformCharacter(width, height * 2); 
     679        shroom.Position = position + new Vector(0, shroom.Height/ 2); 
     680        shroom.Tag = "burn"; 
     681        shroom.Tag += "shroom"; 
     682        //shroom.AnimWalk = new Animation(); 
     683        shroom.CollisionIgnoreGroup = 3; 
     684        Add(shroom, 1); 
     685        //bool immune = false; 
     686 
     687        PlatformWandererBrain brain = new PlatformWandererBrain(); 
     688        brain.Speed = 20; 
     689        brain.FallsOffPlatforms = false; 
     690        shroom.Brain = brain; 
     691 
     692        FollowerBrain attackBrain = new FollowerBrain("player"); 
     693        attackBrain.DistanceFar = Window.Width / 2.5; 
     694        attackBrain.DistanceClose = Window.Width / 2; 
     695        attackBrain.StopWhenTargetClose = false; 
     696        attackBrain.Speed = brain.Speed * 6; 
     697        attackBrain.FarBrain = brain; 
     698        shroom.Brain = attackBrain; 
     699 
     700        int matoja = RandomGen.NextInt(1, 3); 
     701        int rahkeet = 10; 
     702 
     703        //// Taiotaan matoja 
     704        var castTimer = new Timer { Interval = 6.0 }; 
     705        castTimer.Timeout += delegate 
     706        { 
     707            //shroom.PlayAnimation(); 
     708 
     709            Timer.SingleShot(RandomGen.NextDouble(3, 5), delegate { shroom.Brain = attackBrain; }); 
     710 
     711                Timer.SingleShot(1.5, 
     712                    delegate 
     713                    { 
     714                        for (int i = 0; i < matoja; i++) 
     715                       { 
     716                            CreateWorm(shroom.Position + RandomGen.NextVector(- 200, 0, 200, 0), TILE_SIZE, TILE_SIZE); 
     717                            shroom.Brain = brain; 
     718                        } 
     719                    }); 
     720 
     721            
     722        }; 
     723 
     724        attackBrain.TargetClose += delegate() 
     725        { 
     726            if (!castTimer.Enabled) 
     727            { 
     728                castTimer.Start(); 
     729            } 
     730        }; 
     731 
     732        AddCollisionHandler(shroom, "pitchfork", delegate(PhysicsObject s, PhysicsObject f) 
     733        { 
     734            matoja += RandomGen.NextInt(1, 5); 
     735            rahkeet--; 
     736            if(rahkeet<1) 
     737            { 
     738                shroom.Destroy(); 
     739                castTimer.Stop(); 
     740            } 
     741        }); 
     742         
     743     
    674744    } 
    675745 
     
    865935                players.Remove(player); 
    866936 
    867                 //if (player.Improvement != null) 
    868                 //{ 
    869                     GetRidOfImprovement(player); 
    870                     //Improvement parannus = player.Improvement; 
    871                     //parannus.Position = player.Position; 
    872                     //parannus.IsVisible = true; 
    873                     //parannus.IgnoresCollisionResponse = false; 
    874                     //parannus.Tag = "improvement"; 
    875                 //} 
     937                GetRidOfImprovement(player); 
    876938 
    877939                player.Destroy(); 
     
    882944 
    883945        AddCollisionHandler(player, "improvement", CollectImprovement); 
    884         // AddCollisionHandler(player, "improvement", CollectImprovement); 
    885946    } 
    886947 
     
    9601021    public void CreateMilkParticles(HillBilly billy, int size, int xBase, int yBase, Vector position, String tag) 
    9611022    { 
    962         //splash.Play(); 
    9631023        for (int i = 0; i < 10; i++) 
    9641024        { 
     
    9891049    } 
    9901050 
    991     //private void UseImprovement(HillBilly player) 
    992     //{ 
    993     //    if (player.Improvement == null) 
    994     //    {  
    995     //        CreateMilkParticles(player, 5, 100, 100, new Vector(0, player.Height/3), "tears"); 
    996     //        return; 
    997     //    } 
    998     //    player.UseImprovement(player.Improvement); 
    999     //} 
    1000  
    10011051    void Loss() 
    10021052    { 
     
    10211071        //billy.AnimWalk = new Animation(milkWalk); 
    10221072        //billy.AnimIdle = new Animation(milkWalk.CurrentFrame); 
    1023     } 
    1024  
    1025     #region Camera 
    1026     void UpdateCamera() 
    1027     { 
    1028         double minY = players.Min(p => p.Y); 
    1029         double maxY = players.Max(p => p.Y); 
    1030         double minX = players.Min(p => p.X) + cameraOffset; 
    1031  
    1032         Vector minPosition = new Vector(Math.Max(minX, cameraTargetX), minY); 
    1033         Vector maxPosition = new Vector(minX, maxY); 
    1034  
    1035         cameraTarget = (minPosition + maxPosition) * 0.5; 
    1036         cameraTarget.X = Math.Max(cameraTargetX, minX);     //Lellllll. 
    1037  
    1038         //cameraTarget.Y = Math.Max(cameraTarget.X, Level.Bottom + Window.Height/2.0); 
    1039  
    1040         cameraTargetX = Math.Max(cameraTargetX, minX); 
    1041  
    1042         cameraTarget.X = Math.Min(cameraTargetX, rightCamLimit); 
    1043         cameraTarget.Y = Math.Max(cameraTarget.Y, bottomCamLimit); 
    1044  
    1045         double windowMax = Camera.ScreenToWorld(new Vector(Window.Width / 2.0, 0)).X; 
    1046         double windowMin = Camera.ScreenToWorld(new Vector(-Window.Width / 2.0, 0)).X; 
    1047         foreach (var player in players) 
    1048         { 
    1049             player.Left = Math.Max(player.Left, windowMin); 
    1050             player.Right = Math.Min(player.Right, windowMax); 
    1051         } 
    10521073    } 
    10531074 
     
    10661087        Owner.PlayAnimation(Owner.Improvement.Animations[1], evilClone.Destroy); 
    10671088    } 
     1089 
     1090    #region Camera 
     1091    void UpdateCamera() 
     1092    { 
     1093        double minY = players.Min(p => p.Y); 
     1094        double maxY = players.Max(p => p.Y); 
     1095        double minX = players.Min(p => p.X) + cameraOffset; 
     1096 
     1097        Vector minPosition = new Vector(Math.Max(minX, cameraTargetX), minY); 
     1098        Vector maxPosition = new Vector(minX, maxY); 
     1099 
     1100        cameraTarget = (minPosition + maxPosition) * 0.5; 
     1101        cameraTarget.X = Math.Max(cameraTargetX, minX);     //Lellllll. 
     1102 
     1103        //cameraTarget.Y = Math.Max(cameraTarget.X, Level.Bottom + Window.Height/2.0); 
     1104 
     1105        cameraTargetX = Math.Max(cameraTargetX, minX); 
     1106 
     1107        cameraTarget.X = Math.Min(cameraTargetX, rightCamLimit); 
     1108        cameraTarget.Y = Math.Max(cameraTarget.Y, bottomCamLimit); 
     1109 
     1110        double windowMax = Camera.ScreenToWorld(new Vector(Window.Width / 2.0, 0)).X; 
     1111        double windowMin = Camera.ScreenToWorld(new Vector(-Window.Width / 2.0, 0)).X; 
     1112        foreach (var player in players) 
     1113        { 
     1114            player.Left = Math.Max(player.Left, windowMin); 
     1115            player.Right = Math.Min(player.Right, windowMax); 
     1116        } 
     1117    } 
    10681118     
    10691119 
  • 2015/26/ohjaajat/HillbillyRun/HillbillyRun/HillbillyRun/HillbillyRun/HillbillyRun.csproj

    r6147 r6385  
    1818    <XnaOutputType>Game</XnaOutputType> 
    1919    <ApplicationIcon>Game.ico</ApplicationIcon> 
    20     <Thumbnail>GameThumbnail.png</Thumbnail> 
     20    <Thumbnail> 
     21    </Thumbnail> 
    2122    <PublishUrl>publish\</PublishUrl> 
    2223    <Install>true</Install> 
     
    117118  <ItemGroup> 
    118119    <Content Include="Game.ico" /> 
    119     <Content Include="GameThumbnail.png" /> 
    120120  </ItemGroup> 
    121121  <ItemGroup> 
  • 2015/26/ohjaajat/HillbillyRun/HillbillyRun/HillbillyRun/HillbillyRunContent/HillbillyRunContent.contentproj

    r6384 r6385  
    323323    </Compile> 
    324324  </ItemGroup> 
     325  <ItemGroup> 
     326    <Compile Include="GameThumbnail.png"> 
     327      <Name>GameThumbnail</Name> 
     328      <Importer>TextureImporter</Importer> 
     329      <Processor>TextureProcessor</Processor> 
     330    </Compile> 
     331  </ItemGroup> 
    325332  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    326333  <!--  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.