Changeset 1614 for 2010


Ignore:
Timestamp:
2010-08-05 07:52:04 (13 years ago)
Author:
anlakane
Message:

Pistelaskuri.

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

Legend:

Unmodified
Added
Removed
  • 2010/23/hniemi/Matopeli/Content/Content.contentproj

    r1564 r1614  
    1 <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> 
     1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> 
    22  <PropertyGroup> 
    33    <ProjectGuid>c1880545-8a98-46cd-a250-6300a283f9f2</ProjectGuid> 
     
    3434    <Reference Include="Microsoft.Xna.Framework.Content.Pipeline.XImporter, Version=3.1.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d" /> 
    3535  </ItemGroup> 
     36  <ItemGroup> 
     37    <Compile Include="speed.png"> 
     38      <Name>speed</Name> 
     39      <Importer>TextureImporter</Importer> 
     40      <Processor>TextureProcessor</Processor> 
     41    </Compile> 
     42  </ItemGroup> 
    3643</Project> 
  • 2010/23/hniemi/Matopeli/Peli.cs

    r1612 r1614  
    2222    Timer liikutusajastin; 
    2323    Timer kerattavienLisaysAjastin; 
     24    IntMeter pistelaskuri; 
     25 
     26    Image nopeusKuva = LoadImage("speed"); 
    2427 
    2528    protected override void Begin() 
     
    2932        LuoMato(madonPituus); 
    3033        LisaaOhjaimet(); 
     34        LisaaPistelaskuri(); 
    3135        AloitaPeli(); 
    3236    } 
     
    3438    void LuoKentta() 
    3539    { 
     40        Level.BackgroundColor = new Color(50, 50, 50); 
    3641        Level.Height = 500; 
    3742        Level.Width = 500; 
     
    3944        ruutujaPystysuunnassa = (int)Math.Floor(Level.Height / ruudunKoko); 
    4045        ruutujaVaakasuunnassa = (int)Math.Floor(Level.Width / ruudunKoko); 
     46        Camera.ZoomToLevel(); 
     47        Camera.ZoomFactor /= 1.5; 
    4148    } 
    4249 
     
    6976        Keyboard.Listen(Key.Right, ButtonState.Pressed, AsetaSuunta, "Kääntää oikealle", Direction.Right); 
    7077        Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, "Poistuu pelistä"); 
     78    } 
     79 
     80    void LisaaPistelaskuri() 
     81    { 
     82        pistelaskuri = new IntMeter(0); 
     83        Label pisteteksti = new Label("Pisteesi"); 
     84        pisteteksti.Position = new Vector(0, Screen.Top - 45); 
     85        pisteteksti.Color = Color.White; 
     86        Add(pisteteksti); 
     87 
     88        Label pistenaytto = new Label(); 
     89        pistenaytto.Position = new Vector(0, Screen.Top - 80); 
     90        pistenaytto.Color = Color.Magenta; 
     91        pistenaytto.BindTo(pistelaskuri); 
     92        Add(pistenaytto); 
    7193    } 
    7294 
     
    111133        } 
    112134 
    113         if (seuraavanRuudunOlio.Tag.ToString() == "kerattava") 
     135        if (seuraavanRuudunOlio.Tag.ToString().Contains("kerattava")) // Siltä varalta Contains-metodi, että tagissa joutuu jatkossa viemään jotain muutakin 
    114136        { 
    115137            seuraavanRuudunOlio.Destroy(); 
    116138            kerattavat.Remove(seuraavanRuudunOlio); 
    117             madonPituus++; 
     139            pistelaskuri.Value++; 
    118140            LisaaPalaMatoon(); 
    119141        } 
Note: See TracChangeset for help on using the changeset viewer.