Changeset 9746


Ignore:
Timestamp:
2018-06-11 14:45:25 (2 months ago)
Author:
paharvol
Message:
 
Location:
2016/27/PaavoH/TheDiveGame
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • 2016/27/PaavoH/TheDiveGame/TheDiveGame/Content/kentta1.txt

    r9739 r9746  
    1414 ##  ##  ##  ##  ##      #wwwwwwwwwwwwww# 
    1515                         #wwwwwwwwwwwwww# 
    16                          #wwwwwwwwwwwwww# 
     16                      %%%#wwwwwwwwwwwwww# 
    1717######################################### 
  • 2016/27/PaavoH/TheDiveGame/TheDiveGame/Content/obj/Windows/kentta1.mgcontent

    r9739 r9746  
    22<PipelineBuildEvent xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    33  <SourceFile>C:/MyTemp/PaavoH/TheDiveGame/TheDiveGame/Content/kentta1.txt</SourceFile> 
    4   <SourceTime>2018-06-11T12:11:36.2009933+03:00</SourceTime> 
     4  <SourceTime>2018-06-11T14:35:17.9503591+03:00</SourceTime> 
    55  <DestFile>C:/MyTemp/PaavoH/TheDiveGame/TheDiveGame/Content/bin/Windows/kentta1.xnb</DestFile> 
    6   <DestTime>2018-06-11T12:11:36.6779115+03:00</DestTime> 
     6  <DestTime>2018-06-11T14:35:18.4415928+03:00</DestTime> 
    77  <Importer>TextFileImporter</Importer> 
    88  <ImporterTime>2018-01-11T19:43:12+02:00</ImporterTime> 
  • 2016/27/PaavoH/TheDiveGame/TheDiveGame/TheDiveGame.cs

    r9739 r9746  
    2727        LuoKentta(); 
    2828        LisaaNappaimet(); 
     29        AddHealthMeter(); 
    2930 
    3031        Camera.Follow(playerbody); 
     
    3738    void LuoKentta() 
    3839    { 
    39         TileMap kentta = TileMap.FromLevelAsset("Level"); 
     40        TileMap kentta = TileMap.FromLevelAsset("kentta1"); //Level 
    4041        kentta.SetTileMethod('#', LisaaTaso); 
    4142        kentta.SetTileMethod('*', AddShell); 
    4243        kentta.SetTileMethod('w', AddWater); 
     44        kentta.SetTileMethod('%', AddCoral); 
    4345        kentta.SetTileMethod('o', AddPlayer); 
    4446        kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 
     
    6163        shell.Position = paikka; 
    6264        shell.Image = tahtiKuva; 
    63         shell.Tag = "tahti"; 
     65        shell.Tag = "shell"; 
    6466        Add(shell); 
     67    } 
     68 
     69    void AddCoral(Vector paikka, double leveys, double korkeus) 
     70    { 
     71        PhysicsObject coral = PhysicsObject.CreateStaticObject(leveys, korkeus); 
     72        coral.IgnoresCollisionResponse = true; 
     73        coral.Position = paikka; 
     74        coral.Image = tahtiKuva; 
     75        coral.Tag = "coral"; 
     76        Add(coral); 
    6577    } 
    6678 
     
    8193        playerbody.Mass = 4.0; 
    8294        playerbody.Image = pelaajanKuva; 
    83         AddCollisionHandler(playerbody, "tahti", TormaaTahteen); 
     95        AddCollisionHandler(playerbody, "shell", TormaaTahteen); 
     96        AddCollisionHandler(playerbody, "coral", HitCoral); 
    8497        //Add(playerbody, -1); 
    8598 
     
    142155    } 
    143156 
     157    void HitCoral(PhysicsObject hahmo, PhysicsObject coral) 
     158    { 
     159        MessageDisplay.Add("osuit koralliin"); 
     160        coral.Destroy(); 
     161        healthmeter.Value -= 1; 
     162    } 
     163 
    144164    void AddHealthMeter() 
    145165    { 
     
    148168        healthmeter.LowerLimit += LifeOut; 
    149169 
    150         ProgressBar healthbar = new ProgressBar(150, 20); 
    151         healthbar.X = Screen.Left + 150; 
     170        ProgressBar healthbar = new ProgressBar(300, 20); 
     171        healthbar.X = Screen.Left + 500; 
    152172        healthbar.Y = Screen.Top - 20; 
     173        healthbar.BorderColor = Color.Black; 
    153174        healthbar.BindTo(healthmeter); 
    154175        Add(healthbar); 
Note: See TracChangeset for help on using the changeset viewer.