Changeset 1977 for 2011


Ignore:
Timestamp:
2011-06-13 19:18:37 (12 years ago)
Author:
mikrkana
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2011/24/MiskaK/HaxPong/Pong/Pong/Peli.cs

    r1964 r1977  
    3636        LisaaLaskurit(); 
    3737         
     38         
    3839 
    3940 
     
    7273        alaReuna = Level.CreateBottomBorder(); 
    7374        alaReuna.Restitution = 1.0; 
     75         
     76         
    7477        alaReuna.IsVisible = false; 
    7578 
     
    107110    PhysicsObject LuoMaila( double x, double y ) 
    108111    { 
    109         PhysicsObject maila = PhysicsObject.CreateStaticObject(20.0, 100.0); 
     112        PhysicsObject maila = new PhysicsObject(20.0, 100.0); 
    110113        maila.Shape = Shape.Rectangle; 
    111114        maila.X = x; 
    112115        maila.Y = y; 
    113116        maila.Restitution = 1.0; 
     117        maila.CanRotate = false; 
     118        maila.Mass = 50000; 
    114119        Add(maila); 
    115120 
     
    125130        Keyboard.Listen(Key.Space, ButtonState.Down, Haxaa, null); 
    126131        Keyboard.Listen(Key.LeftAlt, ButtonState.Pressed, Haxaa2, null); 
     132        Keyboard.Listen(Key.X, ButtonState.Pressed, Haxaa3, null); 
    127133         
    128134 
     
    156162    void Haxaa() 
    157163    { 
    158         Vector impulssi = new Vector(50.0, 0.0); 
     164        Vector impulssi = new Vector(10.0, 0.0); 
    159165        pallo.Hit(impulssi); 
    160166    } 
     
    164170        maila2.Destroy(); 
    165171 
     172    } 
     173 
     174    void Haxaa3() 
     175    { 
     176        pelaajan1Pisteet.Value += 1; 
     177        
    166178    } 
    167179 
     
    180192        ylaReuna.Destroy(); 
    181193        alaReuna.Destroy(); 
     194        pallo.Restitution = 1.2; 
     195        Gravity = new Vector(0.0, 0.0); 
     196        alaReuna.IgnoresCollisionResponse = false; 
     197         
    182198         
    183199    } 
     
    227243        naytto.Color = Level.BackgroundColor; 
    228244        Add(naytto); 
     245        laskuri.UpperLimit += PeliLoppui; 
    229246        return laskuri; 
    230247 
     248         
     249 
     250    } 
     251 
     252    void PeliLoppui(int arvo) 
     253    { 
     254        alaReuna.IgnoresCollisionResponse = true; 
     255        pallo.Restitution = 0.1; 
     256        Gravity = new Vector(0.0, -800.0); 
     257        Timer.SingleShot(2.0, Loppu); 
     258    } 
     259 
     260    void Loppu() 
     261    { 
     262 
    231263    } 
    232264 
Note: See TracChangeset for help on using the changeset viewer.