Changeset 8570 for 2017


Ignore:
Timestamp:
2017-06-13 12:00:16 (2 years ago)
Author:
npo17_24
Message:

MAilan liikuttamista aloiteltu.

Location:
2017/24/VeikkaL/Pong
Files:
9 edited

Legend:

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

    r8528 r8570  
    99public class Pong : PhysicsGame 
    1010{ 
     11    Vector nopeusYlos = new Vector(0, 200); 
     12    Vector nopeusAlas = new Vector(0, -200); 
    1113    PhysicsObject pallo; 
    1214 
     15    PhysicsObject maila1; 
     16    PhysicsObject maila2; 
    1317    public override void Begin() 
    1418    { 
     19         
    1520        Level.Height = Screen.Height; 
    1621        Level.Width = Screen.Width; 
    1722 
    1823        LuoKentta(); 
     24        AsetaOhjaimet(); 
    1925        AloitaPeli(); 
    2026         
    2127        // TODO: Kirjoita ohjelmakoodisi tähän 
    2228        
    23         Vector impulssi = new Vector(700.0, 0.0); 
     29        Vector impulssi = new Vector(3250.0, 0.0); 
    2430        pallo.Hit(impulssi); 
    2531        
    26         Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
     32         
    2733    } 
    2834 
     
    3743        pallo.Restitution = 1.0; 
    3844        
    39         LuoMaila(Level.Left + 20.0, 0.0); 
    40         LuoMaila(Level.Right - 20.0, 0.0); 
     45      maila1 = LuoMaila(Level.Left + 20.0, 0.0); 
     46      maila2 = LuoMaila(Level.Right - 20.0, 0.0); 
    4147        
    4248 
     
    6066        base.Update(time); 
    6167    } 
    62     void LuoMaila(double x, double y) 
     68    PhysicsObject LuoMaila(double x, double y) 
    6369    { 
    6470        PhysicsObject maila = PhysicsObject.CreateStaticObject(20.0, 100.0); 
     
    6773        maila.Y = y; 
    6874 
     75        pallo.CanRotate = false; 
     76 
    6977        maila.Restitution = 1.0; 
    7078        Add(maila); 
     79        return maila; 
     80    } 
     81    void AsetaOhjaimet() 
     82    { 
     83        Keyboard.Listen(Key.A, ButtonState.Down, AsetaNopeus, "Pelaaja 1: Liikuta mailaa ylös", maila1, nopeusYlos); 
     84        Keyboard.Listen(Key.A, ButtonState.Released, AsetaNopeus, null, maila1, Vector.Zero); 
     85        Keyboard.Listen(Key.Z,) ButtonState.Down,  AsetaNopeus,     
     86 
     87        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
     88 
     89         
     90    } 
     91    void AsetaNopeus(PhysicsObject maila, Vector nopeus) 
     92    { 
     93        maila.Velocity = nopeus; 
    7194    } 
    7295} 
  • 2017/24/VeikkaL/Pong/Pong/Pong/obj/x86/Debug/ContentPipeline-{B13503D5-A7C0-4D9D-A520-CDF9A188F5C9}.xml

    r8509 r8570  
    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-06T10:27:06.3077791+03:00</Value> 
     19        <Value>2017-06-07T09:35:17.7166104+03:00</Value> 
    2020      </Assembly> 
    2121    </Assemblies> 
Note: See TracChangeset for help on using the changeset viewer.