Changeset 8832 for 2017/27


Ignore:
Timestamp:
2017-07-03 12:45:44 (2 years ago)
Author:
npo17_42
Message:

valmista, poijjat

Location:
2017/27/OskariK/Pong
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • 2017/27/OskariK/Pong/Pong/Pong/Pong.cs

    r8824 r8832  
    3333    void LuoKentta() 
    3434    { 
    35         PhysicsObject vasenReuna = Level.CreateLeftBorder(); 
     35        vasenReuna = Level.CreateLeftBorder(); 
    3636        vasenReuna.Restitution = 1.0; 
     37        vasenReuna.KineticFriction = 0.0; 
    3738        vasenReuna.IsVisible = false; 
    3839 
    39         PhysicsObject oikeaReuna = Level.CreateRightBorder(); 
     40        oikeaReuna = Level.CreateRightBorder(); 
    4041        oikeaReuna.Restitution = 1.0; 
     42        oikeaReuna.KineticFriction = 0.0; 
    4143        oikeaReuna.IsVisible = false; 
    4244 
    4345        PhysicsObject ylaReuna = Level.CreateTopBorder(); 
    4446        ylaReuna.Restitution = 1.0; 
     47        ylaReuna.KineticFriction = 0.0; 
    4548        ylaReuna.IsVisible = false; 
     49 
    4650 
    4751        PhysicsObject alaReuna = Level.CreateBottomBorder(); 
    4852        alaReuna.Restitution = 1.0; 
     53        alaReuna.KineticFriction = 0.0; 
    4954        alaReuna.IsVisible = false; 
    5055 
     
    6065        Add(pallo); 
    6166 
    62         AddCollisionHandler(pallo, KasittelePallonTormays); 
     67         
    6368 
    6469        maila1 = LuoMaila(Level.Left + 20.0, 0.0); 
    6570        maila2 = LuoMaila(Level.Right - 20.0, 0.0); 
    66  
     71        AddCollisionHandler(pallo, KasittelePallonTormays); 
    6772    } 
    6873 
     
    148153 
    149154    } 
     155    const double PALLON_MIN_NOPEUS = 500; 
     156 
     157    protected override void Update(Time time) 
     158    { 
     159        if (pallo != null && Math.Abs(pallo.Velocity.X) < PALLON_MIN_NOPEUS) 
     160        { 
     161            pallo.Velocity = new Vector(pallo.Velocity.X * 1.1, pallo.Velocity.Y); 
     162        } 
     163        base.Update(time); 
     164    } 
    150165} 
Note: See TracChangeset for help on using the changeset viewer.