Changeset 6525 for 2015/27


Ignore:
Timestamp:
2015-06-29 14:52:41 (4 years ago)
Author:
misakana
Message:

peli pientä hiomista vailla

Location:
2015/27/EemilI/Pong/Pong
Files:
4 added
2 edited

Legend:

Unmodified
Added
Removed
  • 2015/27/EemilI/Pong/Pong/Pong/Pong.cs

    r6507 r6525  
    1111    PhysicsObject pallo; 
    1212 
    13     Vector nopeusYlos=new Vector(object,200); 
    14     Vector nopeusAlas = new Vector (0, -200); 
     13    Vector nopeusYlos = new Vector(0, 200); 
     14    Vector nopeusAlas = new Vector(0, -200); 
    1515 
    1616    PhysicsObject maila1; 
     
    2222        LuoKentta(); 
    2323        AloitaPeli(); 
     24        AsetaOhjaimet(); 
    2425 
    2526        Vector impulssi = new Vector(1000.0, 350.0); 
     
    3435        //pallo 
    3536 
    36         pallo = new PhysicsObject(60.0, 60.0); 
     37        pallo = new PhysicsObject(LoadImage("Untitled")); 
     38 
     39        pallo.Size = pallo.Size * 0.25; 
    3740        Add(pallo); 
    38         pallo.Shape = Shape.Circle; 
     41         
    3942        pallo.X = -200.0; 
    4043        pallo.Y = 0.0; 
    4144 
    42         LuoMaila(Level.Left + 20.0, 0.0); 
    43         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); 
    4447 
    45          Level.CreateBorders(0.85, false); 
     48        Level.CreateBorders(0.85, false); 
    4649        pallo.Restitution = 1.0; 
    4750 
    48         Level.Background.Color = Color.Crimson; 
     51        Level.Background.Image = LoadImage("MLG SNOOP"); 
    4952 
    5053        Camera.ZoomToLevel(); 
     
    5760    } 
    5861 
    59     void LuoMaila(double x, double y) 
     62    PhysicsObject LuoMaila(double x, double y) 
    6063    { 
    6164        //maila 
     
    6770        maila.Restitution = 1.0; 
    6871        Add(maila); 
     72        return maila; 
    6973    } 
    7074 
    7175    void AsetaOhjaimet() 
    7276    { 
    73         Keyboard.Listen(Key.Up, ButtonState.Down, LiikutaMaila1Ylos, "pelaaja 1: Liikuta mailaa ylös"); 
    74         Keyboard.Listen(Key.Up, ButtonState.Released, PysaytaMaila1 "null"); 
     77        Keyboard.Listen(Key.W, ButtonState.Down, AsetaNopeus, "Pelaaja 1: Liikuta mailaa ylös", maila1, nopeusYlos); 
     78        Keyboard.Listen(Key.W, ButtonState.Released, AsetaNopeus, null, maila1, Vector.Zero); 
     79        Keyboard.Listen(Key.S, ButtonState.Down, AsetaNopeus, "Pelaaja 1:Liikuta mailaa alas", maila1, nopeusAlas); 
     80        Keyboard.Listen(Key.S, ButtonState.Released, AsetaNopeus, null, maila1, Vector.Zero); 
     81 
     82        Keyboard.Listen(Key.Up, ButtonState.Down, AsetaNopeus, "Pelaaja 2: Liikuta mailaa alas", maila2, nopeusYlos); 
     83        Keyboard.Listen(Key.Up, ButtonState.Released, AsetaNopeus, null, maila2, Vector.Zero); 
     84        Keyboard.Listen(Key.Down, ButtonState.Down, AsetaNopeus, "Pelaaja 2: Liikuta mailaa alas", maila2, nopeusAlas); 
     85        Keyboard.Listen(Key.Down, ButtonState.Released, AsetaNopeus, null, maila2, Vector.Zero); 
     86 
     87        Keyboard.Listen(Key.F1, ButtonState.Pressed, ShowControlHelp, "Näytä ohjeet"); 
     88 
    7589 
    7690        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
     91 
    7792    } 
    7893 
    7994    void AsetaNopeus(PhysicsObject maila, Vector nopeus) 
    8095    { 
     96        if ((nopeus.Y < 0) && (maila.Top > Level.Top)) 
     97        { 
     98            maila.Velocity = Vector.Zero; 
     99            return; 
     100        } 
     101        if ((nopeus.Y > 0) && (maila.Top > Level.Top)) 
     102        { 
     103            maila.Velocity = Vector.Zero; 
     104            return; 
     105        } 
    81106        maila.Velocity = nopeus; 
    82107    } 
  • 2015/27/EemilI/Pong/Pong/PongContent/PongContent.contentproj

    r6491 r6525  
    4545    <Reference Include="AnimationExtension" /> 
    4646  </ItemGroup> 
     47  <ItemGroup> 
     48    <Compile Include="dealwithit.png"> 
     49      <Name>dealwithit</Name> 
     50      <Importer>TextureImporter</Importer> 
     51      <Processor>TextureProcessor</Processor> 
     52    </Compile> 
     53  </ItemGroup> 
     54  <ItemGroup> 
     55    <Compile Include="MLG SNOOP.png"> 
     56      <Name>MLG SNOOP</Name> 
     57      <Importer>TextureImporter</Importer> 
     58      <Processor>TextureProcessor</Processor> 
     59    </Compile> 
     60  </ItemGroup> 
    4761  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    4862  <!--  To modify your build process, add your task inside one of the targets below and uncomment it.  
Note: See TracChangeset for help on using the changeset viewer.