Changeset 2601 for 2011/31


Ignore:
Timestamp:
2011-08-05 12:27:48 (8 years ago)
Author:
alnirham
Message:

Talletus.

Location:
2011/31/AleksiN
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • 2011/31/AleksiN/workingtitle.sln

    r2495 r2601  
    22Microsoft Visual Studio Solution File, Format Version 11.00 
    33# Visual Studio 2010 
    4 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "workingtitle", "workingtitle\workingtitle\workingtitle.csproj", "{5436A1C7-8D73-4D32-9CB3-92887150F261}" 
     4Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Peruna", "workingtitle\workingtitle\Peruna.csproj", "{5436A1C7-8D73-4D32-9CB3-92887150F261}" 
    55EndProject 
    6 Project("{96E2B04D-8817-42C6-938A-82C39BA4D311}") = "workingtitleContent", "workingtitle\workingtitleContent\workingtitleContent.contentproj", "{65462838-1B77-4E95-BA3E-E32101E2DAB5}" 
     6Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "workingtitleContent", "workingtitle\workingtitleContent\workingtitleContent.contentproj", "{65462838-1B77-4E95-BA3E-E32101E2DAB5}" 
    77EndProject 
    88Global 
  • 2011/31/AleksiN/workingtitle/workingtitle/Peli.cs

    r2559 r2601  
    1111    Vector hyppynopeus = new Vector(0, 550); 
    1212    Vector nopeus = new Vector(800, 0); 
    13     Vector boost = new Vector(1500, 0); 
    14      
     13    DoubleMeter kello = new DoubleMeter(0); 
     14 
     15    ScoreList topLista = new ScoreList(5, false, 0); 
     16 
     17 
    1518    PhysicsObject ukko; 
    1619 
     
    1821    PhysicsObject punpalikka; 
    1922 
     23    Timer aikaLaskuri = new Timer(); 
     24    DoubleMeter alaspainLaskuri = new DoubleMeter(250); 
     25 
    2026    int kenttanro = 1; 
    2127 
    2228    Image peruna = LoadImage("peruna"); 
    2329    Image portal1 = LoadImage("portal1"); 
     30    SoundEffect shiumm = LoadSoundEffect("shiumm"); 
    2431 
    2532    public override void Begin() 
     
    2734        Gravity = new Vector(0.0, -1000.0); 
    2835 
     36        if (DataStorage.Exists("pisteet.xml")) 
     37            topLista = DataStorage.Load<ScoreList>(topLista, "pisteet.xml"); 
     38 
     39        LuoAikaLaskuri(); 
    2940        hahmot(); 
    3041        kontrollit(); 
     
    4556    void hahmot() 
    4657    { 
    47         ukko = new PhysicsObject(35,50); 
     58        ukko = new PhysicsObject(35, 50); 
    4859        ukko.Shape = Shape.Circle; 
    49         ukko.Color = Color.LimeGreen; 
    50         ukko.Image = LoadImage ("peruna"); 
     60        ukko.Image = LoadImage("peruna"); 
    5161        ukko.KineticFriction = 0.7; 
    5262        ukko.Restitution = 0.15; 
    5363        ukko.X = -875.0; 
    5464        ukko.Y = 275.0; 
    55         AddCollisionHandler(ukko, boostcollisionhandler); 
    5665        AddCollisionHandler(ukko, kuolema); 
    5766        AddCollisionHandler(ukko, seuraavakentta); 
    58          
     67 
    5968        Add(ukko); 
    6069    } 
     
    6574        kentta1palikat(); 
    6675 
    67         Level.BackgroundColor = new Color(30, 30, 80); 
     76        Level.BackgroundColor = new Color(10, 10, 50); 
    6877    } 
    6978 
     
    7988        ukko.Y = 250; 
    8089 
    81         Level.BackgroundColor = new Color(95,70,0); 
     90        Level.BackgroundColor = new Color(95, 70, 0); 
    8291    } 
    8392 
     
    120129 
    121130        PhysicsObject boost = new PhysicsObject(10, 10); 
     131        boost.Shape = Shape.Circle; 
    122132        Add(boost); 
    123133    } 
     
    153163    void kentta1palikat() 
    154164    { 
    155         palikka = palikat(-805.0, 300.0, 50, 1050, Angle.FromDegrees (0)); 
     165        palikka = palikat(-805.0, 300.0, 50, 1050, Angle.FromDegrees(0)); 
    156166        palikka = palikat(-775.0, -210.0, 80, 30, Angle.FromDegrees(0)); 
    157167        palikka = palikat(-775.0, -90.0, 60, 30, Angle.FromDegrees(0)); 
     
    184194        palikka = palikat(805, -30, 35, 30, Angle.FromDegrees(0)); 
    185195        palikka = palikat(640, 55, 35, 30, Angle.FromDegrees(0)); 
    186         palikka = palikat(730, 140, 35, 30, Angle.FromDegrees(0)); 
    187         palikka = palikat(880, 140, 35, 30, Angle.FromDegrees(0)); 
    188         palikka = palikat(1030, 140, 35, 30, Angle.FromDegrees(0)); 
    189         palikka = palikat(1180, 140, 35, 30, Angle.FromDegrees(0)); 
     196        palikka = palikat(730, 150, 35, 30, Angle.FromDegrees(0)); 
     197        palikka = palikat(880, 150, 35, 30, Angle.FromDegrees(0)); 
     198        palikka = palikat(1030, 150, 35, 30, Angle.FromDegrees(0)); 
     199        palikka = palikat(1180, 150, 35, 30, Angle.FromDegrees(0)); 
    190200        punpalikka = punpalikat(-625.0, -80.0, 60, 492, Angle.FromDegrees(0)); 
    191201        punpalikka = punpalikat(-600.0, -150.0, 100, 50, Angle.FromDegrees(0)); 
     
    197207        punpalikka = punpalikat(-1140, -312, 250, 30, Angle.FromDegrees(0)); 
    198208        punpalikka = punpalikat(274, -253, 30, 144, Angle.FromDegrees(0)); 
    199         punpalikka = punpalikat(984, -315, 562, 20, Angle.FromDegrees(0)); 
     209        punpalikka = punpalikat(990, -315, 550, 20, Angle.FromDegrees(0)); 
    200210 
    201211        PhysicsObject maali = PhysicsObject.CreateStaticObject(30, 50); 
     
    215225        test.Tag = "maali"; 
    216226        test.Image = LoadImage("portal1"); 
    217         Add(test); 
     227        //Add(test); 
    218228    } 
    219229 
     
    221231    { 
    222232        PhysicsObject palikka = PhysicsObject.CreateStaticObject(100.0, 100.0); 
    223         palikka.Color = new Color(0,215,215); 
     233        palikka.Color = new Color(0, 215, 215); 
    224234        palikka.X = x; 
    225235        palikka.Y = y; 
     
    232242    } 
    233243 
    234         PhysicsObject palikat2(double x, double y, double width, double height, Angle kulma) 
    235     { 
    236         PhysicsObject palikka = PhysicsObject.CreateStaticObject(100.0,100.0); 
    237         palikka.Color = new Color(255,190,0); 
     244    PhysicsObject palikat2(double x, double y, double width, double height, Angle kulma) 
     245    { 
     246        PhysicsObject palikka = PhysicsObject.CreateStaticObject(100.0, 100.0); 
     247        palikka.Color = new Color(255, 190, 0); 
    238248        palikka.X = x; 
    239249        palikka.Y = y; 
     
    245255        return palikka; 
    246256    } 
     257 
    247258    PhysicsObject punpalikat(double x, double y, double width, double height, Angle kulma) 
    248259    { 
    249         PhysicsObject punpalikka = PhysicsObject.CreateStaticObject(100.0,100.0); 
     260        PhysicsObject punpalikka = PhysicsObject.CreateStaticObject(100.0, 100.0); 
    250261        punpalikka.Color = new Color(128, 0, 0); 
    251262        punpalikka.X = x; 
     
    262273    void kuolema(PhysicsObject pallo, PhysicsObject kohde) 
    263274    { 
    264         if (kohde.Tag.ToString() == "punpalikka") 
     275        if (kohde.Tag.ToString() == "punpalikka" && !(ukko.IsDestroyed)) 
    265276        { 
    266277            ukko.X = -875; 
    267278            ukko.Y = 295; 
     279            shiumm.Play(); 
     280            alaspainLaskuri.Reset(); 
     281            kello.Reset(); 
    268282        } 
    269283    } 
     
    273287        if (kohde.Tag.ToString() == "maali") 
    274288        { 
    275             kenttanro++; 
     289            shiumm.Play(); 
     290            ukko.Destroy(); 
    276291            ClearAll(); 
    277             Begin(); 
    278         } 
    279     } 
    280  
    281     void boostcollisionhandler(PhysicsObject ukko, PhysicsObject kohde) 
    282     { 
    283         if (kohde.Tag.ToString() == "boost") 
    284         { 
    285             boosttapahtuma; 
     292            topikkuna(); 
     293 
    286294        } 
    287295    } 
     
    296304        Keyboard.Listen(Key.Up, ButtonState.Pressed, hyppaa, "Pelaaja hyppää", ukko, hyppynopeus); 
    297305    } 
    298      
     306 
    299307    void liikuta(PhysicsObject ukko, Vector nopeus) 
    300308    { 
     
    304312    void hyppaa(PhysicsObject ukko, Vector hyppynopeus) 
    305313    { 
    306  
    307         //if (ukko.Velocity.Y == 0) 
    308         //{ 
    309             ukko.Hit(hyppynopeus); 
    310         //} 
    311     } 
    312  
    313     void boosttapahtuma(PhysicsObject ukko, Vector boost) 
    314     { 
    315         ukko.Push(boost); 
    316     } 
     314        ukko.Hit(hyppynopeus); 
     315    } 
     316 
     317    void topikkuna() 
     318    { 
     319        double aikaaKulunut = alaspainLaskuri.Value; 
     320 
     321        HighScoreWindow topIkkuna = new HighScoreWindow("Pelin nimi tai jotain", 
     322                             "Parhaat pisteet", 
     323                             "Onneksi olkoon, pääsit listalle pisteillä %p! Syötä nimesi:", 
     324                             topLista, aikaaKulunut); 
     325        topIkkuna.Closed += tallennapisteet; 
     326        Add(topIkkuna);         
     327    } 
     328 
     329    void tallennapisteet(Window sender) 
     330    { 
     331        DataStorage.Save<ScoreList>(topLista, "pisteet.xml"); 
     332        kenttanro++; 
     333        ClearAll(); 
     334        Begin(); 
     335    } 
     336 
     337    void LuoAikaLaskuri() 
     338    { 
     339        alaspainLaskuri = new DoubleMeter(250); 
     340 
     341        aikaLaskuri = new Timer(); 
     342        aikaLaskuri.Interval = 0.01; 
     343        aikaLaskuri.Timeout += LaskeAlaspain; 
     344        aikaLaskuri.Start(); 
     345        kello.Value = 0; 
     346 
     347 
     348        Label aikaNaytto = new Label(); 
     349        aikaNaytto.TextColor = Color.White; 
     350        aikaNaytto.DecimalPlaces = 2; 
     351        aikaNaytto.BindTo(kello); 
     352        aikaNaytto.Y = Screen.Top - 20; 
     353        Add(aikaNaytto); 
     354    } 
     355 
     356    void LaskeAlaspain() 
     357    { 
     358        alaspainLaskuri.Value -= 0.01; 
     359        kello.Value += 0.01; 
     360    } 
     361 
     362 
    317363} 
  • 2011/31/AleksiN/workingtitle/workingtitleContent/workingtitleContent.contentproj

    r2559 r2601  
    5858    </Compile> 
    5959  </ItemGroup> 
     60  <ItemGroup> 
     61    <Compile Include="shiumm.wav"> 
     62      <Name>shiumm</Name> 
     63      <Importer>WavImporter</Importer> 
     64      <Processor>SoundEffectProcessor</Processor> 
     65    </Compile> 
     66  </ItemGroup> 
    6067  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    6168  <!--  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.