Changeset 1305 for 2010/30


Ignore:
Timestamp:
2010-07-27 11:24:56 (9 years ago)
Author:
mikrkana
Message:

Lumiukko ja valmis Pong.

Location:
2010/30/mikrkana
Files:
11 added
1 edited

Legend:

Unmodified
Added
Removed
  • 2010/30/mikrkana/Pong/Peli.cs

    r1291 r1305  
    1717    IntMeter pelaajan2Pisteet; 
    1818 
     19    PhysicsObject vasenReuna; 
     20    PhysicsObject oikeaReuna; 
     21 
    1922 
    2023    protected override void Begin() 
     
    3235    void LuoKentta() 
    3336    { 
    34         pallo = new PhysicsObject(40.0, 40.0); 
    35         pallo.Shape = Shapes.Circle; 
    36         pallo.X = -200.0; 
     37        pallo = new PhysicsObject(40.0, 40.0, Shapes.Circle, CollisionShapeQuality.Best); 
     38        //pallo.Shape = Shapes.Circle; 
     39        pallo.X = 200.0; 
    3740        pallo.Y = 0.0; 
    3841        pallo.Restitution = 1.0; 
     
    4346        maila2 = LuoMaila(Level.Right - 20.0, 0.0); 
    4447 
    45         Level.CreateBorders(1.0, false); 
     48        vasenReuna = Level.CreateLeftBorder(); 
     49        vasenReuna.Restitution = 1.0; 
     50        vasenReuna.IsVisible = false; 
     51 
     52        oikeaReuna = Level.CreateRightBorder(); 
     53        oikeaReuna.Restitution = 1.0; 
     54        oikeaReuna.IsVisible = false; 
     55 
     56        PhysicsObject alaReuna = Level.CreateBottomBorder(); 
     57        alaReuna.Restitution = 1.0; 
     58        alaReuna.IsVisible = false; 
     59 
     60        PhysicsObject yläReuna = Level.CreateTopBorder(); 
     61        yläReuna.Restitution = 1.0; 
     62        yläReuna.IsVisible = false; 
     63 
    4664        Level.BackgroundColor = Color.Black; 
    4765 
     
    122140    void KasittelePallonTormays(PhysicsObject pallo, PhysicsObject kohde) 
    123141    { 
     142        if (kohde == oikeaReuna) 
     143        { 
     144            pelaajan1Pisteet.Value += 1; 
     145        } 
     146        else if (kohde == vasenReuna) 
     147        { 
     148            pelaajan2Pisteet.Value += 1; 
     149        } 
     150 
    124151    } 
    125152 
Note: See TracChangeset for help on using the changeset viewer.