Changeset 8597


Ignore:
Timestamp:
2017-06-13 14:50:16 (6 years ago)
Author:
npo17_26
Message:
 
Location:
2017/24/EllaT
Files:
3 added
10 edited

Legend:

Unmodified
Added
Removed
  • 2017/24/EllaT/PingoPongo/PingoPongo/PingoPongo/PingoPongo.csproj

    r8552 r8597  
    111111  </ItemGroup> 
    112112  <ItemGroup> 
    113     <Compile Include="..\..\PingoPongoBoB.cs" /> 
     113    <Compile Include="..\..\plumbob.cs" /> 
    114114    <Compile Include="Ohjelma.cs" /> 
    115115    <Compile Include="Properties\AssemblyInfo.cs" /> 
  • 2017/24/EllaT/PingoPongo/PingoPongo/PingoPongo/obj/x86/Debug/ContentPipeline-{EACFF0CE-B804-481F-A16E-B89EE77ED547}.xml

    r8552 r8597  
    1717      <Assembly> 
    1818        <Key>C:\WINDOWS\Microsoft.Net\assembly\GAC_32\Microsoft.Xna.Framework.Content.Pipeline\v4.0_4.0.0.0__842cf8be1de50553\Microsoft.Xna.Framework.Content.Pipeline.dll</Key> 
    19         <Value>2016-09-06T09:49:35.0466455+03:00</Value> 
     19        <Value>2017-06-07T09:35:24.5493094+03:00</Value> 
    2020      </Assembly> 
    2121    </Assemblies> 
  • 2017/24/EllaT/PingoPongo/PingoPongoBoB.cs

    r8552 r8597  
    1010{ 
    1111 
     12    Vector nopeusYlos = new Vector(0, 200); 
     13    Vector nopeusAlas = new Vector(0, -200); 
     14 
    1215    PhysicsObject pallo; 
     16 
     17    PhysicsObject maila1; 
     18    PhysicsObject maila2; 
    1319 
    1420    public override void Begin() 
     
    1925 
    2026 
    21         Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
    2227    } 
     28 
     29 
    2330 
    2431 
     
    3441    void AsetaOhjaimet() 
    3542    { 
    36         Keyboard.Listen(Key.A, ButtonState.Down, LiikutaMaila1Ylos, "Pelaaja 1: Liikuta mailaa"); 
    37         Keyboard.Listen(Key.A, ButtonState.Released, PysaytaMaila1, null); 
     43        Keyboard.Listen(Key.A, ButtonState.Down, AsetaNopeus, "Pelaaja 1: Liikuta mailaa ylös", maila1, nopeusYlos); 
     44        Keyboard.Listen(Key.A, ButtonState.Released, AsetaNopeus, null, maila1, Vector.Zero); 
     45        Keyboard.Listen(Key.Z, ButtonState.Down, AsetaNopeus, "Pelaaja 1: Liikuta mailaa alas", maila1, nopeusAlas); 
     46        Keyboard.Listen(Key.Z, ButtonState.Released, AsetaNopeus, null, maila1, Vector.Zero); 
     47 
     48        Keyboard.Listen(Key.Up, ButtonState.Down, AsetaNopeus, "Pelaaja 2: Liikuta mailaa ylös", maila2, nopeusYlos); 
     49        Keyboard.Listen(Key.Up, ButtonState.Released, AsetaNopeus, null, maila2, Vector.Zero); 
     50        Keyboard.Listen(Key.Down, ButtonState.Down, AsetaNopeus, "Pelaaja 2: Liikuta mailaa alas", maila2, nopeusAlas); 
     51        Keyboard.Listen(Key.Down, ButtonState.Released, AsetaNopeus, null, maila2, Vector.Zero); 
     52 
     53        Keyboard.Listen(Key.F1, ButtonState.Pressed, ShowControlHelp, "Näytä ohjeet"); 
     54        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
    3855    } 
    3956 
    40     void LiikutaMailaaYlos(PhysicsObject maila); 
    41     { 
    42     Vector nopeus = new Vector(0, 200); 
    43         maila.Velocity = nopeus; 
    44         } 
     57        
    4558 
    46 void AsetaNopeus(PhysicsObject maila, Vector nopeus) 
    47 { 
    48     maila.Velocity = nopeus; 
    49 } 
     59 
     60     
    5061    void LuoKentta() 
    5162    { 
     
    5667        pallo.Shape = Shape.Diamond; 
    5768        pallo.Color = Color.Lime; 
    58         pallo.Restitution = 1.0; 
     69        pallo.Restitution = 2.0; 
    5970 
    6071 
    61         LuoMaila(Level.Left + 20.0, 0.0); 
    62         LuoMaila(Level.Right - 20.0, 0.0); 
     72        maila1 = LuoMaila(Level.Left + 20.0, 0.0); 
     73        maila2 = LuoMaila(Level.Right - 20.0, 0.0); 
    6374 
    64         Vector impulssi = new Vector(500.0, 0.0); 
     75        Vector impulssi = new Vector(650.0, 0.0); 
    6576        pallo.Hit(impulssi); 
    6677 
     
    7485        Camera.ZoomToLevel(); 
    7586    } 
    76     void LuoMaila(double x, double y) 
     87    PhysicsObject LuoMaila(double x, double y) 
    7788    { 
    7889        PhysicsObject maila = PhysicsObject.CreateStaticObject(20.0, 100.0); 
     
    8293        maila.X = x; 
    8394        maila.Y = y; 
    84         maila.Restitution = 1.0; 
     95        maila.Restitution = 2.0; 
    8596        Add(maila); 
    8697        maila.Color = Color.AshGray; 
     98        return maila; 
    8799    } 
     100 
     101 
     102    void AsetaNopeus(PhysicsObject maila, Vector nopeus) 
     103{ 
     104        maila.Velocity = nopeus; 
     105 
     106 
    88107} 
     108  } 
    89109 
    90110 
    91111 
    92112 
    93  
Note: See TracChangeset for help on using the changeset viewer.