Changeset 9079


Ignore:
Timestamp:
2017-07-25 10:13:04 (2 years ago)
Author:
npo17_65
Message:

Sain pongin valmiiksi

Location:
2017/30/LuukasM/Pong
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • 2017/30/LuukasM/Pong/Pong/Pong/Pong.cs

    r9074 r9079  
    2020    IntMeter pelaajan1Pisteet; 
    2121    IntMeter pelaajan2Pisteet; 
     22 
     23    PhysicsObject oikeaReuna; 
     24    PhysicsObject vasenReuna; 
     25 
    2226 
    2327    public override void Begin() 
     
    4852 
    4953    
    50         PhysicsObject vasenReuna = Level.CreateLeftBorder(); 
     54        vasenReuna = Level.CreateLeftBorder(); 
    5155        vasenReuna.Restitution = 1.0; 
    5256        vasenReuna.IsVisible = false; 
    5357         
    5458 
    55         PhysicsObject oikeaReuna = Level.CreateRightBorder(); 
     59        oikeaReuna = Level.CreateRightBorder(); 
    5660        oikeaReuna.Restitution = 1.0; 
    5761        oikeaReuna.IsVisible = false; 
     
    6266 
    6367 
    64         PhysicsObject ylaReuna = Level.CreateTopBorder; 
     68        PhysicsObject ylaReuna = Level.CreateTopBorder(); 
    6569        ylaReuna.Restitution = 1.0; 
    6670        ylaReuna.IsVisible = false; 
     
    144148        return laskuri; 
    145149    } 
    146     void KasittelePallonTormays(PhysicsObject pallo, PhysicsObject kohde 
     150    void KasittelePallonTormays(PhysicsObject pallo, PhysicsObject kohde) 
     151 
    147152    { 
    148153        if (kohde == oikeaReuna) 
     
    157162    } 
    158163 
     164 
     165    const double PALLON_MIN_NOPEUS = 500; 
     166 
     167    protected override void Update(Time time) 
     168    { 
     169        if (Pallo != null && Math.Abs(Pallo.Velocity.X) < PALLON_MIN_NOPEUS) 
     170        { 
     171            Pallo.Velocity = new Vector(Pallo.Velocity.X * 1.1, Pallo.Velocity.Y); 
     172        } 
     173        base.Update(time); 
     174    } 
     175 
    159176} 
Note: See TracChangeset for help on using the changeset viewer.