Changeset 5664 for 2014/30


Ignore:
Timestamp:
2014-07-25 10:50:41 (9 years ago)
Author:
rohehank
Message:
 
Location:
2014/30/RoosaH/Roskapeli
Files:
9 added
15 edited

Legend:

Unmodified
Added
Removed
  • 2014/30/RoosaH/Roskapeli/Roskapeli/Roskapeli/Roskapeli.cs

    r5630 r5664  
    1313    PhysicsObject ylaReuna; 
    1414    PhysicsObject alaReuna; 
    15     PhysicsObject pelaaja; 
     15 
     16    PlatformCharacter pelaaja; 
    1617 
    1718    List<PhysicsObject> roskat = new List<PhysicsObject>(); 
    1819     
    19  
    2020    IntMeter keratytEsineet; 
    2121 
    2222    Timer ajastin; 
     23 
     24    private Image[] hahmonkavely = LoadImages("hahmo2", "hahmo"); 
     25     
     26    private Image[] hahmonseisominen = LoadImages("hahmo3"); 
     27    private Image[] hahmonkuolema = LoadImages("hahmo4"); 
    2328 
    2429    Image hahmonkuva = LoadImage("hahmo");     
    2530    Image roskankuva = LoadImage("roska"); 
    2631    Image tausta = LoadImage("Tausta"); 
    27      
     32    
    2833 
    2934    public override void Begin() 
     
    3439 
    3540        valikko(); 
    36         
    3741    } 
    3842    void AloitaPeli() 
     
    8387        Add(alaReuna); 
    8488 
    85          
    86  
    8789        Level.Background.Color = Color.White; 
    8890        Level.Background.Image = tausta; 
     
    9193    void AsetaOhjaimet() 
    9294    { 
    93         Keyboard.Listen(Key.Left, ButtonState.Down, LiikutaPelaajaa, "Pelaaja liikkuu vasemmalle", new Vector(-200.0, 0.0)); 
    94         Keyboard.Listen(Key.Right, ButtonState.Down, LiikutaPelaajaa, "Pelaaja liikkuu oikealle", new Vector(200.0, 0.0)); 
    95         Keyboard.Listen(Key.Left, ButtonState.Released, LiikutaPelaajaa, null, Vector.Zero); 
    96         Keyboard.Listen(Key.Right, ButtonState.Released, LiikutaPelaajaa, null, Vector.Zero); 
     95        Keyboard.Listen(Key.Left, ButtonState.Down, LiikutaPelaajaa, "Pelaaja liikkuu vasemmalle", -200.0); 
     96        Keyboard.Listen(Key.Right, ButtonState.Down, LiikutaPelaajaa, "Pelaaja liikkuu oikealle", 200.0); 
     97        //Keyboard.Listen(Key.Left, ButtonState.Released, LiikutaPelaajaa, null, Vector.Zero); 
     98        //Keyboard.Listen(Key.Right, ButtonState.Released, LiikutaPelaajaa, null, Vector.Zero); 
    9799        Mouse.Listen(MouseButton.Left, ButtonState.Pressed, keraa, "Keraa roskan"); 
    98100        PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 
    99101        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
    100  
    101     } 
    102     void LiikutaPelaajaa(Vector suunta) 
    103     { 
    104         pelaaja.Velocity = suunta; 
    105     } 
    106     PhysicsObject LuoPelaaja(double x, double y) 
    107     { 
    108         PhysicsObject pelaaja = new PhysicsObject(100.0, 150.0); 
     102    } 
     103    void LiikutaPelaajaa(double suunta) 
     104    { 
     105        pelaaja.Walk(suunta); 
     106        //pelaaja.Velocity = suunta; 
     107    } 
     108    PlatformCharacter LuoPelaaja(double x, double y) 
     109    { 
     110        PlatformCharacter pelaaja = new PlatformCharacter(100.0, 150.0); 
    109111        Add(pelaaja); 
    110112        pelaaja.Image = hahmonkuva; 
     113        //pelaaja.Animation = new Animation(hahmonkavely); 
     114        pelaaja.AnimWalk = new Animation(hahmonkavely); 
     115        pelaaja.AnimIdle = new Animation(hahmonseisominen); 
     116         pelaaja.AnimWalk.FPS = (2); 
     117         //Animation pelaajaPeilattu = Animation.Mirror(); 
     118         //pelaaja.Animation.Start(); 
     119         
    111120        pelaaja.Mass = 90000; 
    112121        pelaaja.Restitution = 0.0; 
     
    114123        pelaaja.Y = y; 
    115124        pelaaja.CanRotate = false; 
     125         
    116126        return pelaaja; 
    117127    } 
     
    127137        roska.Y = y; 
    128138        return roska; 
    129  
    130139    } 
    131140    void keraa() 
     
    135144            if (Vector.Distance(roska.Position, pelaaja.Position) < 100.0) 
    136145            { 
    137                 
    138146               roska.Destroy(); 
    139147               roskat.Remove(roska); 
     
    142150            } 
    143151        } 
    144          
    145152    } 
    146153    void Lisaaroskia() 
     
    151158        PhysicsObject uusiroska = Luoroska(satunnainenX, satunnainenY); 
    152159        roskat.Add(uusiroska); 
     160         
     161 
    153162        if (roskat.Count >= 8) 
    154163        { 
    155164            Label gameover = new Label("Game Over"); 
    156165            gameover.Color = Color.White; 
     166            ClearControls();  
     167            Image rage = LoadImage("hahmo4"); 
     168            pelaaja.AnimIdle = new Animation (hahmonkuolema); 
    157169            Add(gameover); 
    158             ClearControls();                   
     170                              
    159171            ajastin.Stop(); 
    160172            Timer.SingleShot(4.0, valikko); 
     
    181193        alkuValikko.AddItemHandler(0, AloitaPeli); 
    182194        alkuValikko.AddItemHandler(1, Exit); 
     195        alkuValikko.Color = Color.White; 
    183196        Add(alkuValikko); 
    184  
    185     } 
    186  
    187     } 
    188      
    189      
    190      
     197    } 
     198 
     199    } 
     200     
     201     
     202     
  • 2014/30/RoosaH/Roskapeli/Roskapeli/Roskapeli/Roskapeli.csproj.Debug.cachefile

    r5629 r5664  
    33Content\Tausta.xnb 
    44Content\hahmo2.xnb 
     5Content\hahmo3.xnb 
     6Content\hahmo4.xnb 
  • 2014/30/RoosaH/Roskapeli/Roskapeli/Roskapeli/obj/x86/Debug/ContentPipeline-{6B75B0A9-AF5F-495D-BD9C-473F93CC40FA}.xml

    r5629 r5664  
    99      <Options>None</Options> 
    1010      <Output>C:\MyTemp\RoosaH\Roskapeli\Roskapeli\Roskapeli\bin\x86\Debug\Content\hahmo.xnb</Output> 
    11       <Time>2014-07-23T09:57:42.9539875+03:00</Time> 
     11      <Time>2014-07-24T14:36:08.8169683+03:00</Time> 
    1212    </Item> 
    1313    <Item> 
     
    2828      <Output>C:\MyTemp\RoosaH\Roskapeli\Roskapeli\Roskapeli\bin\x86\Debug\Content\Tausta.xnb</Output> 
    2929      <Time>2014-07-23T13:16:17.5101928+03:00</Time> 
     30    </Item> 
     31    <Item> 
     32      <Source>hahmo2.png</Source> 
     33      <Name>hahmo2</Name> 
     34      <Importer>TextureImporter</Importer> 
     35      <Processor>TextureProcessor</Processor> 
     36      <Options>None</Options> 
     37      <Output>C:\MyTemp\RoosaH\Roskapeli\Roskapeli\Roskapeli\bin\x86\Debug\Content\hahmo2.xnb</Output> 
     38      <Time>2014-07-24T14:39:40.1791024+03:00</Time> 
     39    </Item> 
     40    <Item> 
     41      <Source>hahmo3.png</Source> 
     42      <Name>hahmo3</Name> 
     43      <Importer>TextureImporter</Importer> 
     44      <Processor>TextureProcessor</Processor> 
     45      <Options>None</Options> 
     46      <Output>C:\MyTemp\RoosaH\Roskapeli\Roskapeli\Roskapeli\bin\x86\Debug\Content\hahmo3.xnb</Output> 
     47      <Time>2014-07-25T09:51:45.8992156+03:00</Time> 
     48    </Item> 
     49    <Item> 
     50      <Source>hahmo4.png</Source> 
     51      <Name>hahmo4</Name> 
     52      <Importer>TextureImporter</Importer> 
     53      <Processor>TextureProcessor</Processor> 
     54      <Options>None</Options> 
     55      <Output>C:\MyTemp\RoosaH\Roskapeli\Roskapeli\Roskapeli\bin\x86\Debug\Content\hahmo4.xnb</Output> 
     56      <Time>2014-07-25T10:16:52.5128619+03:00</Time> 
    3057    </Item> 
    3158    <BuildSuccessful>true</BuildSuccessful> 
  • 2014/30/RoosaH/Roskapeli/Roskapeli/Roskapeli/obj/x86/Debug/Roskapeli.csproj.FileListAbsolute.txt

    r5629 r5664  
    1010C:\MyTemp\RoosaH\Roskapeli\Roskapeli\Roskapeli\bin\x86\Debug\Content\roska.xnb 
    1111C:\MyTemp\RoosaH\Roskapeli\Roskapeli\Roskapeli\bin\x86\Debug\Content\Tausta.xnb 
     12C:\MyTemp\RoosaH\Roskapeli\Roskapeli\Roskapeli\bin\x86\Debug\Content\hahmo2.xnb 
     13C:\MyTemp\RoosaH\Roskapeli\Roskapeli\Roskapeli\bin\x86\Debug\Content\hahmo3.xnb 
     14C:\MyTemp\RoosaH\Roskapeli\Roskapeli\Roskapeli\bin\x86\Debug\Content\hahmo4.xnb 
  • 2014/30/RoosaH/Roskapeli/Roskapeli/Roskapeli/obj/x86/Debug/cachefile-{6B75B0A9-AF5F-495D-BD9C-473F93CC40FA}-targetpath.txt

    r5629 r5664  
    22Content\roska.xnb 
    33Content\Tausta.xnb 
     4Content\hahmo2.xnb 
     5Content\hahmo3.xnb 
     6Content\hahmo4.xnb 
  • 2014/30/RoosaH/Roskapeli/Roskapeli/RoskapeliContent/RoskapeliContent.contentproj

    r5629 r5664  
    6666    </Compile> 
    6767  </ItemGroup> 
     68  <ItemGroup> 
     69    <Compile Include="hahmo2.png"> 
     70      <Name>hahmo2</Name> 
     71      <Importer>TextureImporter</Importer> 
     72      <Processor>TextureProcessor</Processor> 
     73    </Compile> 
     74  </ItemGroup> 
     75  <ItemGroup> 
     76    <Compile Include="hahmo3.png"> 
     77      <Name>hahmo3</Name> 
     78      <Importer>TextureImporter</Importer> 
     79      <Processor>TextureProcessor</Processor> 
     80    </Compile> 
     81  </ItemGroup> 
     82  <ItemGroup> 
     83    <Compile Include="hahmo4.png"> 
     84      <Name>hahmo4</Name> 
     85      <Importer>TextureImporter</Importer> 
     86      <Processor>TextureProcessor</Processor> 
     87    </Compile> 
     88  </ItemGroup> 
    6889  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    6990  <!--  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.