Changeset 4520 for 2013/30


Ignore:
Timestamp:
2013-07-22 14:56:08 (6 years ago)
Author:
alraniko
Message:

Talletus.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2013/30/AleksiK/Pong/Pong/Pong/Pong.cs

    r4511 r4520  
    99public class Pong : PhysicsGame 
    1010{ 
    11     Vector nopeusYlos = new Vector(0, 200); 
    12     Vector nopeusAlas = new Vector(0, -200); 
     11    Vector nopeusYlos = new Vector(0, 500); 
     12    Vector nopeusAlas = new Vector(0, -500); 
     13    Vector nopeusVasen = new Vector(-500, 0); 
     14    Vector nopeusOikea = new Vector(500, 0); 
    1315 
    1416    PhysicsObject pallo; 
     
    3941        vasenReuna.Restitution = 1.0; 
    4042        vasenReuna.IsVisible = false; 
     43        vasenReuna.KineticFriction = 0.0; 
    4144 
    4245        oikeaReuna = Level.CreateRightBorder(); 
    4346        oikeaReuna.Restitution = 1.0; 
    4447        oikeaReuna.IsVisible = false; 
     48        oikeaReuna.KineticFriction = 0.0; 
    4549 
    4650        PhysicsObject ylaReuna = Level.CreateTopBorder(); 
    4751        ylaReuna.Restitution = 1.0; 
    4852        ylaReuna.IsVisible = false; 
     53        ylaReuna.KineticFriction = 0.0; 
    4954 
    5055        PhysicsObject alaReuna = Level.CreateBottomBorder(); 
    5156        alaReuna.Restitution = 1.0; 
    5257        alaReuna.IsVisible = false; 
     58        alaReuna.KineticFriction = 0.0; 
    5359 
    5460        Level.BackgroundColor = Color.Black; 
    5561        Camera.ZoomToLevel(); 
    5662 
    57         pallo = new PhysicsObject(40.0, 40.0, Shape.Circle); 
     63        pallo = new PhysicsObject(40.0, 40.0, Shape.Rectangle); 
     64        pallo.Restitution = 1.0; 
     65        pallo.MomentOfInertia = Double.PositiveInfinity; 
     66        pallo.KineticFriction = 0.0; 
     67        pallo.CanRotate = true; 
    5868        Add(pallo); 
    59         pallo.Restitution = 1.0; 
    6069 
    6170        maila1 = LuoMaila(Level.Left + 20.0, 0.0); 
     
    6372 
    6473        AddCollisionHandler(pallo, KasittelePallonTormays); 
    65  
    6674    } 
    6775 
    6876    void AloitaPeli() 
    6977    { 
    70         Vector impulssi = new Vector(1000.0, 0.0); 
     78        Vector impulssi = new Vector(900.0, 0.0); 
    7179        pallo.Hit(impulssi); 
    7280    } 
     
    7987        maila.Y = y; 
    8088        maila.Restitution = 1.0; 
     89        maila.KineticFriction = 0.0; 
    8190        Add(maila); 
    8291        return maila; 
     
    8796        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, null); 
    8897 
    89         Keyboard.Listen(Key.A, ButtonState.Down, AsetaNopeus, null, maila1, nopeusYlos); 
     98        Keyboard.Listen(Key.W, ButtonState.Down, AsetaNopeus, null, maila1, nopeusYlos); 
     99        Keyboard.Listen(Key.W, ButtonState.Released, AsetaNopeus, null, maila1, Vector.Zero); 
     100        Keyboard.Listen(Key.S, ButtonState.Down, AsetaNopeus, null, maila1, nopeusAlas); 
     101        Keyboard.Listen(Key.S, ButtonState.Released, AsetaNopeus, null, maila1, Vector.Zero); 
     102 
     103        Keyboard.Listen(Key.D, ButtonState.Down, AsetaNopeus, null, maila1, nopeusOikea); 
     104        Keyboard.Listen(Key.D, ButtonState.Released, AsetaNopeus, null, maila1, Vector.Zero); 
     105        Keyboard.Listen(Key.A, ButtonState.Down, AsetaNopeus, null, maila1, nopeusVasen); 
    90106        Keyboard.Listen(Key.A, ButtonState.Released, AsetaNopeus, null, maila1, Vector.Zero); 
    91         Keyboard.Listen(Key.Z, ButtonState.Down, AsetaNopeus, null, maila1, nopeusAlas); 
    92         Keyboard.Listen(Key.Z, ButtonState.Released, AsetaNopeus, null, maila1, Vector.Zero); 
    93107 
    94108        Keyboard.Listen(Key.Up, ButtonState.Down, AsetaNopeus, null, maila2, nopeusYlos); 
     
    97111        Keyboard.Listen(Key.Down, ButtonState.Released, AsetaNopeus, null, maila2, Vector.Zero); 
    98112 
     113        Keyboard.Listen(Key.Right, ButtonState.Down, AsetaNopeus, null, maila2, nopeusOikea); 
     114        Keyboard.Listen(Key.Right, ButtonState.Released, AsetaNopeus, null, maila2, Vector.Zero); 
     115        Keyboard.Listen(Key.Left, ButtonState.Down, AsetaNopeus, null, maila2, nopeusVasen); 
     116        Keyboard.Listen(Key.Left, ButtonState.Released, AsetaNopeus, null, maila2, Vector.Zero); 
    99117    } 
    100118 
Note: See TracChangeset for help on using the changeset viewer.