Changeset 8531 for 2017/24


Ignore:
Timestamp:
2017-06-12 14:58:43 (2 years ago)
Author:
npo17_29
Message:
 
Location:
2017/24/TuukkaP/Pong
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • 2017/24/TuukkaP/Pong/Pong/Pong/Pong.cs

    r8501 r8531  
    99public class Pong : PhysicsGame 
    1010 
     11 
    1112{ 
     13 
     14    Vector nopeusYlos = new Vector(0, 200); 
     15    Vector nopeusAlas = new Vector(0, -200); 
     16 
     17    PhysicsObject pallo; 
     18 
     19    PhysicsObject maila1; 
     20    PhysicsObject maila2; 
     21 
    1222    const double PALLON_MIN_NOPEUS = 500; 
    1323 
     
    4252 
    4353    { 
    44         PhysicsObject maila = PhysicsObject.CreateStaticObject(20.0, 100.0); 
    45         maila.Shape = Shape.Rectangle; 
    46         maila.X = Level.Left + 20.0; 
    47         maila.Y = 0.0; 
    48         maila.Restitution = 1.0; 
    49         Add(maila); 
     54        LuoMaila(Level.Left + 20.0, 0.0); 
     55        LuoMaila(Level.Right - 20.0, 0.0); 
    5056 
    5157        pallo = new PhysicsObject(40.0, 40.0); 
     
    7177        maila.Restitution = 1.0; 
    7278        Add(maila); 
     79        void AsetaOhjaimet() 
     80{ 
     81            Keyboard.Listen(Key.A, ButtonState.Down, LiikutaMaila1Ylos, "Pelaaja 1: Liikuta mailaa ylös"); 
     82            Keyboard.Listen(Key.A, ButtonState.Released, PysaytaMaila1, null); 
     83 
     84            Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
     85            void AsetaNopeus(PhysicsObject maila, Vector nopeus) 
     86{ 
     87    maila.Velocity = 200.0; 
     88} 
     89        } 
    7390    } 
     91 
    7492 
    7593} 
Note: See TracChangeset for help on using the changeset viewer.