Changeset 1263


Ignore:
Timestamp:
2010-07-23 10:12:20 (9 years ago)
Author:
anlakane
Message:

Pikku fiksauksia.

Location:
2010/27/anlakane/Nopeuspeli
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • 2010/27/anlakane/Nopeuspeli/Nopeuspeli.csproj

    r1212 r1263  
    5757  </PropertyGroup> 
    5858  <ItemGroup> 
    59     <Reference Include="Jypeli2, Version=2.2.5.0, Culture=neutral, processorArchitecture=x86"> 
     59    <Reference Include="Jypeli2, Version=2.3.0.0, Culture=neutral, processorArchitecture=x86"> 
    6060      <SpecificVersion>False</SpecificVersion> 
    61       <HintPath>..\..\..\..\..\lib\Jypeli2.dll</HintPath> 
     61      <HintPath>..\..\..\..\..\npo\trunk\Jypeli\bin\x86\Debug\Jypeli2.dll</HintPath> 
    6262    </Reference> 
    6363    <Reference Include="Microsoft.Xna.Framework, Version=3.1.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d" /> 
  • 2010/27/anlakane/Nopeuspeli/Peli.cs

    r1261 r1263  
    1515    Animation painike3animaatio; 
    1616 
    17     const double painikkeenLeveys = 200; 
     17    const double painikkeenLeveys = 100; 
    1818    const double painikkeenKorkeus = painikkeenLeveys; 
    1919    Timer painikkeidenSytytin; 
     
    3030    Sound piip; 
    3131 
     32    HighScoreList topten; 
     33 
    3234    protected override void Begin() 
    3335    { 
     
    3638        painikkeidenMaara = 4; 
    3739 
    38         SetWindowSize(600, 400, false); 
     40        SetWindowSize(900, 600, false); 
     41 
     42        Level.Width = 800; 
     43        Level.Height = 500; 
    3944        Level.Background.Image = LoadImage("tausta"); 
    4045        Level.Background.Size = new Vector(Screen.Width, Screen.Height); 
    4146        MessageDisplay.TextColor = Color.White; 
    42         LisaaNappaimet(); 
     47        Camera.ZoomToLevel(); 
     48 
     49        topten = HighScoreList.LoadOrCreate("topten.dat", 10); 
     50 
    4351        LisaaPainikkeet(); 
     52 
    4453        LuoAjastimet(); 
    4554        LataaAanet(); 
     
    7281        aikaaPainaaUuttaNappia.Trigger += PeliPaattyy; 
    7382        Add(aikaaPainaaUuttaNappia); 
    74  
    7583    } 
    7684 
     
    7987    { 
    8088        pistenaytto = new Label(montakoPainikettaPainettu.ToString()); 
    81         pistenaytto.Position = new Vector(0, -200); 
     89        pistenaytto.X = 0; 
     90        pistenaytto.Y = -50; 
    8291        pistenaytto.TextColor = Color.White; 
    8392        Add(pistenaytto); 
     
    108117    { 
    109118        GameObject painike = new GameObject(painikkeenLeveys, painikkeenKorkeus); 
    110         painike.Color = RandomGen.NextColor(); 
    111         byte r = painike.Color.RedComponent; 
    112         byte g = painike.Color.GreenComponent; 
    113         byte b = painike.Color.BlueComponent; 
    114         r = (byte)((double)r / 1.5); 
    115         g = (byte)((double)g / 1.5); 
    116         b = (byte)((double)b / 1.5); 
    117         painike.Color = new Color(r, g, b); 
    118  
    119119        painikkeet.Add(painike); 
    120         painike.X = -((painikkeidenMaara / 2) * (painikkeenLeveys + 20)) + ((painikkeet.Count) * (painikkeenLeveys + 20)) - 20; 
     120        painike.X = -((painikkeidenMaara / 2) * (painikkeenLeveys + 20)) + ((painikkeet.Count) * (painikkeenLeveys + 20)) - (painikkeenLeveys/2); 
    121121        painike.Tag = painikkeet.Count.ToString(); 
    122122        painike.Image = LoadImage((painikkeet.Count - 1).ToString() + "_"); 
    123  
    124123        return painike; 
    125124    } 
     
    136135        //Keyboard.Listen(Key., ButtonState.Pressed, NappainPainettu, null, 7); 
    137136 
     137        Keyboard.Listen(Key.Left, ButtonState.Down, delegate() { pistenaytto.X -= 2; MessageDisplay.Add("" + pistenaytto.X + " " + pistenaytto.Y); }, null); 
     138        Keyboard.Listen(Key.Right, ButtonState.Down, delegate() { pistenaytto.X += 2; MessageDisplay.Add("" + pistenaytto.X + " " + pistenaytto.Y); }, null); 
     139        Keyboard.Listen(Key.Down, ButtonState.Down, delegate() { pistenaytto.Y -= 2; MessageDisplay.Add("" + pistenaytto.X + " " + pistenaytto.Y); }, null); 
     140        Keyboard.Listen(Key.Up, ButtonState.Down, delegate() { pistenaytto.Y += 2; MessageDisplay.Add("" + pistenaytto.X + " " + pistenaytto.Y); }, null); 
     141 
     142 
    138143    } 
    139144 
     
    155160    { 
    156161        peliPaattynyt = true; 
     162        ClearControls(); 
    157163        painikkeidenSytytin.Stop(); 
    158164        nopeutusAjastin.Stop(); 
     
    160166        painamattomat.Clear(); 
    161167        for (int i = 0; i < painikkeet.Count; i++) 
     168        { 
    162169            Sytyta(i); 
     170        } 
     171        Timer.SingleShot(1, NaytaTopTenJaSalliUudenPelinAloitus); 
     172    } 
     173 
     174    void NaytaTopTenJaSalliUudenPelinAloitus() 
     175    { 
     176        topten.CongratulationText = "Anna nimi"; 
     177        topten.ScreenList.BackGroundColor = Color.DarkGray; 
     178        topten.Show(montakoPainikettaPainettu); 
    163179        Keyboard.Listen(Key.Enter, ButtonState.Pressed, AloitaPeli, null); 
     180 
    164181    } 
    165182 
     
    167184    { 
    168185        peliPaattynyt = false; 
     186        LisaaNappaimet(); 
     187 
     188        topten.Hide(); 
    169189        for (int i = 0; i < painikkeet.Count; i++) 
    170190        { 
Note: See TracChangeset for help on using the changeset viewer.