Changeset 3592 for 2012/27


Ignore:
Timestamp:
2012-07-05 14:40:30 (11 years ago)
Author:
majaraut
Message:

Talletus.

Location:
2012/27/MattiR/FysiikkaPeli3/FysiikkaPeli3
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • 2012/27/MattiR/FysiikkaPeli3/FysiikkaPeli3/FysiikkaPeli3/FysiikkaPeli3.cs

    r3540 r3592  
    1616    Image[] vasemmalleTippuminen; 
    1717    Image[] tippumisAnimaatio = LoadImages("fall 1","fall 2"); 
     18    IntMeter HPlaskuri; 
    1819    public override void Begin() 
    1920    { 
    2021        // TODO: Kirjoita ohjelmakoodisi tähän 
    21         MediaPlayer.Play( "Kalimba" ); 
    2222        kävelyVasemmalle = Image.Mirror(ssprites); 
    2323        vasemmallePaikallaan = Image.Mirror(pictures); 
     
    2525        LuoPelaaja(); 
    2626        Gravity = new Vector(0, -500); 
     27        Luokentta(); 
    2728        Level.CreateBorders(); 
    2829        keyboard(); 
    2930        PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 
    3031        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
     32        LuoHPmittari(); 
     33        Camera.ZoomToLevel(); 
     34    } 
     35    void Luokentta() 
     36    { 
     37        TileMap ruudut = TileMap.FromLevelAsset("kenttä 1"); 
     38        ruudut.SetTileMethod('-', Luotaso); 
     39        ruudut.SetTileMethod('v', Lasertykki); 
     40        ruudut.Execute(13, 13); 
     41    } 
     42    void Luotaso(Vector paikka, double leveys, double korkeus) 
     43    { 
     44        PhysicsObject taso = PhysicsObject.CreateStaticObject(13, 13); 
     45        taso.Position = paikka; 
     46        Add(taso); 
    3147    } 
    3248    void LuoPelaaja() 
    3349    { 
    34         pelaaja1 = new PlatformCharacter(85.0, 96.0); 
     50        pelaaja1 = new PlatformCharacter(14.0, 15.0); 
    3551        Add(pelaaja1); 
    3652        pelaaja1.RightIdleAnimation = new Animation(pictures); 
     
    6682    { 
    6783        pelaaja.Walk(Nopeus);  
    68      
    6984    } 
    7085    void hyppaa(PlatformCharacter pelaaja) 
     
    7893        pelaaja.LeftIdleAnimation.FPS = 4; 
    7994    } 
     95    void LuoHPmittari() 
     96    { 
     97        HPlaskuri = new IntMeter(100); 
     98        Label HPnaytto = new Label(); 
     99        HPnaytto.X = Screen.Left + 100; 
     100        HPnaytto.Y = Screen.Top - 100; 
     101        HPnaytto.TextColor = Color.Black; 
     102        HPnaytto.Color = Color.Blue; 
     103 
     104        HPnaytto.BindTo(HPlaskuri); 
     105        Add(HPnaytto); 
     106    } 
     107    void Lasertykki(Vector paikka, double leveys, double korkeus) 
     108    { 
     109        PhysicsObject Lasertykki = PhysicsObject.CreateStaticObject(20, 10); 
     110        Lasertykki.Position = paikka; 
     111        Lasertykki.Shape = Shape.Rectangle; 
     112         
     113        Add(Lasertykki); 
     114        Timer ajastin = new Timer(); 
     115        ajastin.Interval = 1; 
     116        ajastin.Timeout += delegate { ammu(Lasertykki.Position - new Vector(Lasertykki.Width / 2, 0)); }; 
     117        ajastin.Start(); 
     118    } 
     119    void ammu(Vector paikka) 
     120    { 
     121        PhysicsObject ammus = new PhysicsObject(13, 14); 
     122        ammus.Position = paikka; 
     123        ammus.Shape = Shape.Circle; 
     124        Add(ammus); 
     125        ammus.Hit(new Vector(-600, 0)); 
     126        ammus.MaximumLifetime = TimeSpan.FromSeconds(1.0); 
     127    } 
    80128} 
  • 2012/27/MattiR/FysiikkaPeli3/FysiikkaPeli3/FysiikkaPeli3Content/FysiikkaPeli3Content.contentproj

    r3540 r3592  
    106106    </Compile> 
    107107  </ItemGroup> 
     108  <ItemGroup> 
     109    <Compile Include="kenttä 1.txt"> 
     110      <Name>kenttä 1</Name> 
     111      <Importer>TextFileImporter</Importer> 
     112      <Processor>TextFileContentProcessor</Processor> 
     113    </Compile> 
     114  </ItemGroup> 
    108115  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    109116  <!--  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.