Changeset 1840 for 2011/23


Ignore:
Timestamp:
2011-06-09 22:08:45 (12 years ago)
Author:
hejumunt
Message:
 
Location:
2011/23/hejumunt/RunRunRun/RunRunRun
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • 2011/23/hejumunt/RunRunRun/RunRunRun/RunRunRun/Peli.cs

    r1814 r1840  
    2828    Image kodinKuva = LoadImage("koti"); 
    2929    Image taustaKuva = LoadImage("tausta1"); 
     30    Image autonKuva = LoadImage("auto"); 
     31    Image tasonKuva = LoadImage("pikkutaso"); 
    3032    Shape hahmonMuoto; 
    3133 
     
    3638    Timer ajastin = new Timer();  
    3739    int kenttäNro = 1; 
    38     int kenttäMäärä = 2; 
     40    int kenttäMäärä = 3; 
    3941 
    4042    List<Label> valikonKohdat; 
     
    5456        ajastin.Stop(); 
    5557 
    56         // Miksi taustakuva ei näy kun pelistä tullaan pois escillä?? 
    5758        Level.Width = Screen.Width; 
    5859        Level.Height = Screen.Height; 
     
    6061        Camera.Reset(); 
    6162 
    62         //Level.Background.Size = new Vector(Screen.Width, Screen.Height); 
    63         Level.Background.Image = taustaKuva; 
    64         //Level.Background.Size = new Vector(Screen.Width, Screen.Height); 
    65         //Level.Background.FitToLevel(); 
     63        Level.Background.Image = taustaKuva;  
    6664        Level.Background.Width = Screen.Width; 
    6765        Level.Background.Height = Screen.Height; 
     
    114112            elämät--; 
    115113            if (elämät > 0) { Uudestaan(); } 
    116             else 
    117             { 
    118                 gameover(); 
    119             } 
    120  
    121  
    122         } 
    123  
     114            else { gameover(); } 
     115        } 
    124116    } 
    125117    void Lopeta() 
     
    142134        Valikko(); // Taustakuva ei näy? ks. r53 
    143135    } 
     136 
     137    // Menettää elämän ja kenttä käynnistyy alusta 
    144138    void Uudestaan() 
    145139    { 
     
    173167        kentta['E'] = lisaaKello; 
    174168        kentta['M'] = lisaaKoti; 
     169        kentta['A'] = lisaaAuto; 
     170        kentta['-'] = lisaapikkuTaso; 
    175171        kentta.Insert(40.0, 40.0); 
    176172 
     
    182178 
    183179        Add(hahmo); 
    184  
    185         //PhysicsObject alaReuna = Level.CreateBottomBorder(1.0, true); 
    186180        Gravity = new Vector(0.0, -800.0); 
    187         //Level.CreateBorders(); 
    188181        Camera.Follow(hahmo); 
    189182        Camera.StayInLevel = true; 
    190         //Timer ajastin = new Timer(); 
    191         //ajastin.Interval = 0.01; 
    192         //ajastin.Trigger += liikutaHahmoa 
    193         //ajastin.Start(); 
    194183    } 
    195184    void kasittelehahmontormays(PhysicsObject hahmo, PhysicsObject kohde) 
     
    212201        kenttäNro++; 
    213202        ClearAll(); 
     203        ajastin.Stop(); 
    214204        if (kenttäNro > kenttäMäärä) 
    215205        { 
     
    225215            Keyboard.Listen(Key.Enter, ButtonState.Pressed, SeuraavaKentta, null); 
    226216            Keyboard.Listen(Key.Escape, ButtonState.Pressed, Palaaminen, null); 
    227             // voittoteksti 
    228             // 3 sekunnin paasta SeuraavaKentta(); 
    229             // Timer.SingleShot... 
    230217        } 
    231218    } 
     
    250237        alaspainLaskuri = new DoubleMeter(15); 
    251238 
     239        LuoAjastin(); 
     240 
     241        Label aikaNaytto = new Label(); 
     242        aikaNaytto.TextColor = Color.Black; 
     243        aikaNaytto.BindTo(alaspainLaskuri); 
     244        Add(aikaNaytto); 
     245 
     246        Mouse.IsCursorVisible = false; 
     247 
     248    } 
     249    void LuoAjastin() 
     250    { 
    252251        ajastin = new Timer(); 
    253252        ajastin.Interval = 0.1; 
    254253        ajastin.Trigger += aikaloppui; 
    255254        ajastin.Start(); 
    256  
    257         Label aikaNaytto = new Label(); 
    258         aikaNaytto.TextColor = Color.Black; 
    259         aikaNaytto.BindTo(alaspainLaskuri); 
    260         Add(aikaNaytto); 
    261  
    262         Mouse.IsCursorVisible = false; 
    263  
     255    } 
     256    PhysicsObject lisaapikkuTaso() 
     257    { 
     258        PhysicsObject pikkuTaso = PhysicsObject.CreateStaticObject(50, 20); 
     259       pikkuTaso.Image = tasonKuva; 
     260       return pikkuTaso; 
     261    } 
     262    PhysicsObject lisaaAuto() 
     263    { 
     264        PhysicsObject auto = PhysicsObject.CreateStaticObject(200, 80); 
     265        auto.Image = autonKuva; 
     266        return auto; 
    264267    } 
    265268 
     
    368371        elämät = 3; 
    369372        alaspainLaskuri = new DoubleMeter(15); 
    370  
    371         
     373        ajastin = new Timer(); 
     374         
    372375        ajastin.Interval = 0.1; 
    373376        ajastin.Trigger += aikaloppui; 
     
    407410        Keyboard.Listen(Key.F1, ButtonState.Pressed, ShowControlHelp, "Näytä ohjeet"); 
    408411        Keyboard.Listen(Key.Escape, ButtonState.Pressed, Valikko, "Poistu valikkoon"); 
    409  
     412        Keyboard.Listen(Key.Insert, ButtonState.Pressed, kenttaloppui, null); 
     413        Keyboard.Listen(Key.End, ButtonState.Pressed, cheat, null); 
     414        Keyboard.Listen(Key.NumPad7, ButtonState.Pressed, cheat1, null); 
     415         
     416    } 
     417    void cheat() 
     418    { 
     419        ajastin.Stop(); 
     420    } 
     421    void cheat1() 
     422    { 
     423        ajastin.Start(); 
    410424    } 
    411425    void AsetaNopeus(Vector vektori) 
  • 2011/23/hejumunt/RunRunRun/RunRunRun/RunRunRun/RunRunRun.csproj

    r1814 r1840  
    125125      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    126126    </Content> 
     127    <Content Include="kentta3.txt"> 
     128      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 
     129    </Content> 
    127130  </ItemGroup> 
    128131  <ItemGroup> 
  • 2011/23/hejumunt/RunRunRun/RunRunRun/RunRunRunContent/RunRunRunContent.contentproj

    r1814 r1840  
    182182    </Compile> 
    183183  </ItemGroup> 
     184  <ItemGroup> 
     185    <Compile Include="Auto.png"> 
     186      <Name>Auto</Name> 
     187      <Importer>TextureImporter</Importer> 
     188      <Processor>TextureProcessor</Processor> 
     189    </Compile> 
     190  </ItemGroup> 
     191  <ItemGroup> 
     192    <Compile Include="pikkutaso.png"> 
     193      <Name>pikkutaso</Name> 
     194      <Importer>TextureImporter</Importer> 
     195      <Processor>TextureProcessor</Processor> 
     196    </Compile> 
     197  </ItemGroup> 
    184198  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    185199  <!--  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.