Changeset 1585 for 2010


Ignore:
Timestamp:
2010-08-04 08:59:31 (13 years ago)
Author:
anlakane
Message:

Vähän lisää.

Location:
2010/23/hniemi/Matopeli
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • 2010/23/hniemi/Matopeli/Matopeli.csproj

    r1564 r1585  
    5757  </PropertyGroup> 
    5858  <ItemGroup> 
    59     <Reference Include="Jypeli2, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86"> 
     59    <Reference Include="Jypeli2, Version=2.4.1.0, Culture=neutral, processorArchitecture=x86"> 
    6060      <SpecificVersion>False</SpecificVersion> 
    61       <HintPath>..\..\lib\Jypeli2.dll</HintPath> 
     61      <HintPath>..\..\..\..\..\lib\Jypeli2.dll</HintPath> 
    6262    </Reference> 
    6363    <Reference Include="Microsoft.Xna.Framework, Version=3.1.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d" /> 
  • 2010/23/hniemi/Matopeli/Peli.cs

    r1564 r1585  
    88{ 
    99    //GameObject[] mato; 
    10     const double ruudunleveys = 20; 
     10    const double ruudunKoko = 20; 
    1111    const int madonPituus = 6; 
    12  
     12    int ruutujaVaakasuunnassa; 
     13    int ruutujaPystysuunnassa; 
    1314    List<GameObject> mato = new List<GameObject>(); 
     15    List<GameObject> kerattavat = new List<GameObject>(); 
    1416    Direction liikkumissuunta; 
    1517    Timer liikutusajastin; 
     
    1719    protected override void Begin() 
    1820    { 
    19          
     21        LuoKentta(); 
    2022        LuoLiikutusAjastin(); 
    2123        LuoMato(madonPituus); 
     
    2426    } 
    2527 
     28    void LuoKentta() 
     29    { 
     30        Level.Height = 500; 
     31        Level.Width = 500; 
     32        ruutujaPystysuunnassa = (int)Math.Floor(Level.Height / ruudunKoko); 
     33        ruutujaVaakasuunnassa = (int)Math.Floor(Level.Width / ruudunKoko); 
     34    } 
     35 
    2636    void LuoMato(int pituus) 
    2737    { 
    2838        for (int i = 0; i < pituus-1; i++) 
    2939        { 
    30             mato.Add(new GameObject(ruudunleveys - 1, ruudunleveys - 1)); 
     40            mato.Add(new GameObject(ruudunKoko - 1, ruudunKoko - 1)); 
    3141            Add(mato[i]); 
    3242        } 
    3343        //Luo madon pään viimeiseksi, jotta sen pään värin muuttaminen näkyy 
    3444        //Aka. Too lazy for layers 
    35         mato.Insert(0, new GameObject(ruudunleveys - 1, ruudunleveys - 1)); 
     45        mato.Insert(0, new GameObject(ruudunKoko - 1, ruudunKoko - 1)); 
    3646        Add(mato[0]);  
    3747    } 
     
    4454        Keyboard.Listen(Key.Right, ButtonState.Pressed, AsetaSuunta, "Kääntää oikealle", Direction.Right); 
    4555        Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, "Poistuu pelistä"); 
     56    } 
     57 
     58    void LuoKerattava() 
     59    { 
     60        GameObject kerattava = new GameObject(ruudunKoko / 2, ruudunKoko / 2, Shapes.Circle); 
     61         
     62        Add(kerattava); 
     63        kerattavat.Add(kerattava); 
     64 
    4665    } 
    4766 
     
    6079    void SiirraMatoa(Timer ajastin) 
    6180    { 
    62         Vector suunta = Vector.FromLengthAndAngle(ruudunleveys, Angle.FromDirection(liikkumissuunta)); 
     81        Vector suunta = Vector.FromLengthAndAngle(ruudunKoko, Angle.FromDirection(liikkumissuunta)); 
    6382 
    6483        for (int i = mato.Count-1; i > 0; i--) 
Note: See TracChangeset for help on using the changeset viewer.