Changeset 1573 for 2010/31


Ignore:
Timestamp:
2010-08-03 14:57:25 (9 years ago)
Author:
paaaanro
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2010/31/jomaveij/Pong/Peli.cs

    r1532 r1573  
    66public class Peli : PhysicsGame 
    77{ 
     8    PhysicsObject pallero; 
     9    Vector yhaylosyrittaa = new Vector(0, 200); 
     10    Vector maanalainen = new Vector(); 
     11 
    812    protected override void Begin() 
    913    { 
    10         PhysicsObject pallero = new PhysicsObject(39.9, 40.0); 
     14        Kentta(); 
     15        Ohjustukikohta(); 
     16        Alota(); 
     17        PingPong(Level.Left + 20, 0.0); 
     18        PingPong(Level.Right - 20, 0.0); 
     19    } 
     20 
     21    void Kentta() 
     22    { 
     23        pallero = new PhysicsObject(39.9, 40.0); 
    1124        pallero.Shape = Shapes.Circle; 
    1225        pallero.Y = 100.82346277835; 
    1326        Add(pallero); 
     27        pallero.Restitution = 1.0; 
     28        Level.CreateBorders(1.0, true); 
     29        Level.BackgroundColor = Color.ForestGreen; 
     30        Camera.ZoomToLevel(); 
     31    } 
    1432 
    15         Vector newton = new Vector(1000.5, -500.2); 
     33    void Alota() 
     34    { 
     35        Vector newton = new Vector(1000.0, 500.0); 
    1636        pallero.Hit(newton); 
     37    } 
     38    void PingPong(double x, double y) 
     39    { 
     40        PhysicsObject pong = PhysicsObject.CreateStaticObject(20.0, 50.0); 
     41        pong.Position = new Vector(x, y); 
     42        pong.Restitution = 1.0; 
     43        Add(pong); 
     44    } 
    1745 
    18         Level.CreateBorders(); 
     46    void Ohjustukikohta() 
     47    { 
     48        Keyboard.Listen(Key.A, ButtonState.Down, LiikutaMailaaYlos, "Pelaaja 1: Liikuta mailaa ylös"); 
     49        Keyboard.Listen(Key.A, ButtonState.Released, PysaytaMaila, null); 
     50        Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, "Poistu!!!"); 
     51    } 
     52 
     53    void Vauhdikkuus(PhysicsObject pong, Vector vauhti) 
     54    { 
     55        pong.Velocity = vauhti; 
    1956    } 
    2057} 
Note: See TracChangeset for help on using the changeset viewer.