Changeset 1985 for 2011/24


Ignore:
Timestamp:
2011-06-14 14:37:13 (8 years ago)
Author:
elalylon
Message:

Tein Pixel Questin taustaa eteenpäin

Location:
2011/24/EliasY
Files:
14 added
1 edited

Legend:

Unmodified
Added
Removed
  • 2011/24/EliasY/Pong/Pong/Pong/Peli.cs

    r1961 r1985  
    99public class Peli : PhysicsGame 
    1010{ 
    11     Vector nopeusYlos = new Vector (0, 500); 
    12     Vector nopeusAlas = new Vector(0, -500); 
     11    Vector nopeusYlos = new Vector (0, 1000); 
     12    Vector nopeusAlas = new Vector(0, -1000); 
    1313 
    1414    PhysicsObject maila1; 
     
    1919    IntMeter pelaajan1pisteet; 
    2020    IntMeter pelaajan2pisteet; 
     21 
     22    PhysicsObject VasenReuna; 
     23    PhysicsObject OikeaReuna; 
    2124 
    2225    public override void Begin() 
     
    3235        pallo.Shape = Shape.Circle; 
    3336        pallo.Restitution = 1.0; 
     37        pallo.CanRotate = false; 
     38        pallo.KineticFriction = 0; 
    3439        Add (pallo); 
    3540 
    36         pallo.X = -200; 
     41        pallo.X = 0; 
    3742        pallo.Y = 0; 
    3843 
     
    4045        maila2 = LuoMaila(Level.Right - 20.0, 0); 
    4146 
    42         PhysicsObject VasenReuna = Level.CreateLeftBorder(); 
    43         VasenReuna.Restitution = 1.0; 
     47        VasenReuna = Level.CreateLeftBorder(); 
     48        VasenReuna.Restitution = 1; 
    4449        VasenReuna.IsVisible = false; 
     50 
     51        OikeaReuna = Level.CreateRightBorder(); 
     52        OikeaReuna.Restitution = 1; 
     53        OikeaReuna.IsVisible = false; 
     54 
     55        PhysicsObject YlaReuna = Level.CreateTopBorder(); 
     56        YlaReuna.Restitution = 1; 
     57        YlaReuna.IsVisible = false; 
     58 
     59        PhysicsObject AlaReuna = Level.CreateBottomBorder(); 
     60        AlaReuna.Restitution = 1; 
     61        AlaReuna.IsVisible = false; 
    4562 
    4663        Level.BackgroundColor = Color.Black; 
     
    5976    { 
    6077        IntMeter laskuri = new IntMeter(0); 
    61         laskuri.MaxValue = 10; 
    6278        Label naytto = new Label(); 
    6379        naytto.BindTo (laskuri); 
     
    7389    void KasittelePallonTormays(PhysicsObject pallo, PhysicsObject kohde) 
    7490    { 
     91        if (kohde == OikeaReuna) 
     92        { 
     93            pelaajan1pisteet.Value += 1; 
     94        } 
    7595 
     96        else if (kohde == VasenReuna) 
     97        { 
     98            pelaajan2pisteet.Value += 1; 
     99        } 
    76100    } 
    77101 
     
    117141    void AloitaPeli() 
    118142    { 
    119         Vector impulssi = new Vector(500, 0); 
     143        Vector impulssi = new Vector(1000, 0); 
    120144        pallo.Hit(impulssi); 
    121145    } 
Note: See TracChangeset for help on using the changeset viewer.