Changeset 6386 for 2015/26


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

Kolmatta kenttää tehty. Vipu ja portti lisätty.

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

Legend:

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

    r6385 r6386  
    176176 
    177177    # region Images 
    178     private Image[] groundImages = LoadImages("ground", "ground_forest");    //Näitä ei tosin kaikkia kenties jaksa tehdä erilaisiksi levelistä riippuen 
    179     private Image[] groundTopImages = LoadImages("ground_top", "ground_top_forest"); 
    180     private Image[] foregroundDecorations = LoadImages("viljaa", "grass"); 
     178    private Image[] groundImages = LoadImages("ground", "ground_forest", "ground");    //Näitä ei tosin kaikkia kenties jaksa tehdä erilaisiksi levelistä riippuen 
     179    private Image[] groundTopImages = LoadImages("ground_top", "ground_top_forest", "ground_top"); 
     180    private Image[] foregroundDecorations = LoadImages("viljaa", "grass", "grass"); 
    181181    private Image[] blockImages = LoadImages("box2", "rock"); 
    182182 
     
    197197    private Image forestBackgroundImage = LoadImage("forestbackground"); 
    198198    private Image swingTrapImage = LoadImage("tukki"); 
     199 
     200    private Image gateImage = LoadImage("gate"); 
     201    private Image leverLeftImage = LoadImage("lever_left"); 
     202    private Image leverRightImage = LoadImage("lever_right"); 
    199203 
    200204    private Animation crawl; 
     
    435439        level.SetTileMethod(Color.FromHexCode("A17FFF"), CreatePitchfork); 
    436440 
    437         level.SetTileMethod(Color.Gray, (new AbstractTileMap<Color>.TileMethod[] { CreateCrawly, CreateWorm })[levelNumber]); // ಠ_ಠ 
    438         level.SetTileMethod(Color.Red, (new AbstractTileMap<Color>.TileMethod[] { CreateFireMage, CreateShroom })[levelNumber]); 
     441        level.SetTileMethod(Color.Gray, (new AbstractTileMap<Color>.TileMethod[] { CreateCrawly, CreateWorm, null })[levelNumber]); // ಠ_ಠ 
     442        level.SetTileMethod(Color.Red, (new AbstractTileMap<Color>.TileMethod[] { CreateFireMage, CreateShroom, null })[levelNumber]); 
    439443        level.SetTileMethod(Color.White, CreateBlockObject); 
    440444        level.SetTileMethod(Color.DarkGray, CreateMilk); 
     
    448452        level.SetTileMethod(Color.FromHexCode("5B7F00"), CreateSwingTrap); 
    449453 
     454        level.SetTileMethod(Color.FromHexCode("7FBA00"), CreateGate); 
     455        level.SetTileMethod(Color.FromHexCode("4C7F00"), CreateLevel); 
     456 
    450457        level.Optimize(Color.Brown);    //Color.Black   //Tekee jännittäviä asioita wheatille, jos optimoidaan (tietysti). Jotenn.  
    451458 
    452459        level.Execute(TILE_SIZE, TILE_SIZE); 
     460    } 
     461 
     462    void CreateGate(Vector position, double width, double height) 
     463    { 
     464        PhysicsObject gate = PhysicsObject.CreateStaticObject(width, height); 
     465        gate.Image = gateImage; 
     466        gate.Color = Color.HotPink; 
     467        gate.Position = position; 
     468        gate.Y -= height / 2.0; 
     469        gate.Tag = "gate"; 
     470        Add(gate); 
     471    } 
     472 
     473    void CreateLevel(Vector position, double width, double height) 
     474    { 
     475        PhysicsObject lever = PhysicsObject.CreateStaticObject(width * 0.5, height); 
     476        lever.Image = leverLeftImage; 
     477        lever.Color = Color.Green; 
     478        lever.Position = position; 
     479        lever.Y -= height / 2.0; 
     480        lever.IgnoresCollisionResponse = true; 
     481        Add(lever); 
     482 
     483        AddCollisionHandler(lever, "player", delegate(PhysicsObject p, PhysicsObject l) 
     484        { 
     485            if (lever.Image == leverLeftImage) 
     486            { 
     487                lever.Image = leverRightImage; 
     488                GetObjectsWithTag("gate").ForEach(g => g.Destroy()); 
     489            } 
     490        }); 
    453491    } 
    454492 
     
    934972            { 
    935973                players.Remove(player); 
    936  
    937974                GetRidOfImprovement(player); 
    938  
    939975                player.Destroy(); 
    940  
    941  
    942976            } 
    943977        }; 
     
    10081042    void GetRidOfImprovement(HillBilly player) 
    10091043    { 
    1010         if(player.Improvement != null) 
     1044        if (player.Improvement != null) 
    10111045        { 
    10121046            Improvement parannus = player.Improvement; 
     
    11161150        } 
    11171151    } 
    1118      
     1152 
    11191153 
    11201154    protected override void Update(Time time) 
  • 2015/26/ohjaajat/HillbillyRun/HillbillyRun/HillbillyRun/HillbillyRunContent/HillbillyRunContent.contentproj

    r6385 r6386  
    324324  </ItemGroup> 
    325325  <ItemGroup> 
    326     <Compile Include="GameThumbnail.png"> 
    327       <Name>GameThumbnail</Name> 
     326    <Compile Include="level2.png"> 
     327      <Name>level2</Name> 
     328      <Importer>TextureImporter</Importer> 
     329      <Processor>TextureProcessor</Processor> 
     330    </Compile> 
     331  </ItemGroup> 
     332  <ItemGroup> 
     333    <Compile Include="lever_left.png"> 
     334      <Name>lever_left</Name> 
     335      <Importer>TextureImporter</Importer> 
     336      <Processor>TextureProcessor</Processor> 
     337    </Compile> 
     338    <Compile Include="lever_right.png"> 
     339      <Name>lever_right</Name> 
     340      <Importer>TextureImporter</Importer> 
     341      <Processor>TextureProcessor</Processor> 
     342    </Compile> 
     343  </ItemGroup> 
     344  <ItemGroup> 
     345    <Compile Include="gate.png"> 
     346      <Name>gate</Name> 
    328347      <Importer>TextureImporter</Importer> 
    329348      <Processor>TextureProcessor</Processor> 
Note: See TracChangeset for help on using the changeset viewer.