Changeset 8903


Ignore:
Timestamp:
2017-07-05 09:20:20 (2 years ago)
Author:
sieerinn
Message:

Silmukka ja satunnaisluvut.

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

Legend:

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

    r8869 r8903  
    3030    void OsuiPalloon(PhysicsObject tormaaja, PhysicsObject kohde) 
    3131    { 
    32         tormaaja.Size *= 1.2; 
     32        tormaaja.Size *= 1.1; 
    3333        kohde.Destroy(); 
    3434    } 
     
    3636    void OsuiPahaPalloon(PhysicsObject tormaaja, PhysicsObject kohde) 
    3737    { 
    38         tormaaja.Destroy(); 
     38        tormaaja.Size *= 0.8; 
     39        kohde.Destroy(); 
    3940    } 
    4041 
    4142    void LuoKentta() 
    4243    { 
     44        Level.Width = Window.Width; 
     45        Level.Height= Window.Height; 
     46 
    4347        LuoPelaaja(); 
    4448 
    45         LuoPallo(-100, -50); 
    46         LuoPallo(0, 70); 
    47         LuoPallo(100, -20); 
    48         LuoPallo(180, 70); 
    49         LuoPallo(-150, -90); 
     49        for (int i = 0; i < 120; i++) 
     50        { 
     51            LuoPallo(RandomGen.NextDouble(Level.Left, Level.Right), RandomGen.NextDouble(Level.Bottom, Level.Top)); 
     52        } 
    5053 
    51         LuoPahaPallo(200, -80); 
    52         LuoPahaPallo(-250, -150); 
    53         LuoPahaPallo(220, 90); 
     54        for (int i = 0; i < 60; i++) 
     55        { 
     56            LuoPahaPallo(RandomGen.NextDouble(Level.Left, Level.Right), RandomGen.NextDouble(Level.Bottom, Level.Top)); 
     57        } 
     58 
     59        Level.Background.Color = Color.Black; 
     60        Level.CreateBorders(); 
    5461    } 
    5562 
    5663    void LuoPallo(double x, double y) 
    5764    { 
    58         PhysicsObject pallo = new PhysicsObject(50, 50); 
     65        PhysicsObject pallo = new PhysicsObject(10, 10); 
    5966        pallo.Tag = "pallo"; 
    6067        pallo.Shape = Shape.Circle; 
     
    6673    void LuoPahaPallo(double x, double y) 
    6774    { 
    68         PhysicsObject pallo = new PhysicsObject(50, 50); 
     75        PhysicsObject pallo = new PhysicsObject(20, 20); 
    6976        pallo.Tag = "pahapallo"; 
    7077        pallo.Shape = Shape.Circle; 
Note: See TracChangeset for help on using the changeset viewer.