Changeset 6567 for 2015


Ignore:
Timestamp:
2015-06-30 11:17:17 (8 years ago)
Author:
misakana
Message:
 
Location:
2015/27/TapaniS/ProjectStar/ProjectStar/ProjectStar
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • 2015/27/TapaniS/ProjectStar/ProjectStar/ProjectStar/ProjectStar.cs

    r6565 r6567  
    99public class ProjectStar : PhysicsGame 
    1010{ 
     11    IntMeter pisteLaskuri; 
     12 
    1113    Image tasoKuva = LoadImage("monttu"); 
    1214    Image taustaKuva = LoadImage("Pemppe3"); 
     
    2123    { 
    2224        //Level.Background.Image = taustaKuva; 
    23          
    24         Level.Size = new Vector(1500, 1000);  
     25 
     26        Level.Size = new Vector(1500, 1000); 
    2527        //Level.CreateBorders(); 
    2628        //Camera.ZoomToLevel(); 
    2729 
    28         ukko = new PlatformCharacter( 40.0, 40.0); 
     30        ukko = new PlatformCharacter(40.0, 40.0); 
     31 
     32        PhysicsObject aloitus = new PhysicsObject(100.0, 20.0); 
     33        Add(aloitus); 
     34        aloitus.IgnoresGravity = true; 
     35        Add(ukko); 
     36        ukko.Color = Color.Purple; 
     37        AddCollisionHandler(ukko, "piste", PelaajaSaaPisteen); 
    2938 
    3039        for (int i = 0; i < 20; i++) 
     
    3443 
    3544 
    36             Add(ukko); 
    37             ukko.Color = Color.Purple; 
    38  
    39             PhysicsObject aloitus = new PhysicsObject(100.0, 20.0); 
    40             Add(aloitus); 
    41             aloitus.IgnoresGravity = true; 
    42              
    4345            PhysicsObject piste = new PhysicsObject(20, 20); 
    4446            piste.IgnoresGravity = true; 
     
    5860        Level.Background.Image = taustaKuva; 
    5961        //Camera.ZoomToLevel(); 
    60         Level.CreateBorders(1, 1, 2, 1.0, Color.Transparent);    
     62        Level.CreateBorders(1, 1, 2, 1.0, Color.Transparent); 
    6163        //Level.Size = new Vector(1650, 1050);             
    6264        //Level.Background.FitToLevel(); 
    6365 
    6466        LiikutaUkkoa(); 
    65              
     67 
     68        LuoPistelaskuri(); 
     69 
    6670        // TODO: Kirjoita ohjelmakoodisi tähän 
    6771 
     
    8892    } 
    8993 
    90     void Pelaajaosuu() 
    91     { 
    92  
    93     } 
    94  
    95     IntMeter pisteLaskuri; 
    9694 
    9795    void LuoPistelaskuri() 
    9896    { 
     97        pisteLaskuri = new IntMeter(0); 
     98 
    9999        Label pisteNaytto = new Label(); 
    100100        pisteNaytto.X = Screen.Left + 100; 
     
    105105        pisteNaytto.BindTo(pisteLaskuri); 
    106106        Add(pisteNaytto); 
    107         LuoPistelaskuri(); 
    108107        pisteNaytto.Title = "Pisteet"; 
    109108 
     
    111110    } 
    112111 
     112    void PelaajaSaaPisteen(PhysicsObject ukko, PhysicsObject piste) 
     113    { 
     114        pisteLaskuri.Value++; 
     115        piste.Destroy(); 
     116    } 
    113117} 
Note: See TracChangeset for help on using the changeset viewer.