Changeset 4063 for 2013/24/NicoL


Ignore:
Timestamp:
2013-06-11 11:01:15 (6 years ago)
Author:
anlakane
Message:
 
Location:
2013/24/NicoL/Pong
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • 2013/24/NicoL/Pong/Pong/Pong/Pong.cs

    r4055 r4063  
    99public class Pong : PhysicsGame 
    1010{ 
    11     Vector nopeusYlos = new Vector(0, 200); 
    12     Vector nopeusAlas = new Vector(0, -200); 
     11    Image mailu1 = LoadImage("Maila1"); 
     12    Image mailu2=LoadImage("Maila2"); 
     13    Image pallu = LoadImage("Untitled"); 
     14 
     15    Vector nopeusYlos = new Vector(0, 400); 
     16    Vector nopeusAlas = new Vector(0, -400); 
    1317 
    1418    PhysicsObject pallo; 
     19 
    1520    IntMeter pelaajan1Pisteet; 
    1621    IntMeter pelaajan2Pisteet; 
     
    1823    PhysicsObject maila1; 
    1924    PhysicsObject maila2; 
     25 
     26    PhysicsObject vasenReuna; 
     27    PhysicsObject oikeaReuna; 
    2028 
    2129 
     
    4149        pallo.Y = 0.0; 
    4250        pallo.Restitution = 1.0; 
     51        pallo.Image = pallu; 
     52 
    4353        AddCollisionHandler(pallo, KasittelePallonTormays); 
    4454 
    4555        maila1 = LuoMaila(Level.Left + 20.0, 0.0); 
     56        maila1.Image = mailu1; 
     57 
    4658        maila2 = LuoMaila(Level.Right - 20.0, 0.0); 
     59        maila2.Image = mailu2; 
    4760 
    48         PhysicsObject vasenReuna = Level.CreateLeftBorder(); 
     61        vasenReuna = Level.CreateLeftBorder(); 
    4962        vasenReuna.Restitution = 1.0; 
    5063        vasenReuna.IsVisible = false; 
    5164 
    52         PhysicsObject oikeaReuna = Level.CreateRightBorder(); 
     65        oikeaReuna = Level.CreateRightBorder(); 
    5366        oikeaReuna.Restitution = 1.0; 
    5467        oikeaReuna.IsVisible = false; 
     
    7083    void AloitaPeli() 
    7184    { 
    72         Vector impulssi = new Vector(300.0, 0.0); 
     85        Vector impulssi = new Vector(500.0, 0.0); 
    7386        pallo.Hit(impulssi); 
    7487    } 
     
    116129        maila.Velocity = nopeus; 
    117130    } 
    118     void LisaaLaskurit(double x, double y) 
     131    void LisaaLaskurit() 
    119132    { 
    120         // ... 
     133        pelaajan1Pisteet = LuoPisteLaskuri(Screen.Left + 100.0, Screen.Top - 100.0); 
     134        pelaajan2Pisteet = LuoPisteLaskuri(Screen.Right - 100.0, Screen.Top - 100.0); 
    121135    } 
    122     IntMeter LuoPisteLaskuri() 
     136    IntMeter LuoPisteLaskuri(Double x, Double y) 
    123137    { 
    124138        IntMeter laskuri = new IntMeter(0); 
    125139        laskuri.MaxValue = 10; 
     140 
    126141        Label naytto = new Label(); 
    127142        naytto.BindTo(laskuri); 
     
    137152    void KasittelePallonTormays(PhysicsObject pallo, PhysicsObject kohde) 
    138153    { 
    139  
     154        if (kohde == oikeaReuna) 
     155        { 
     156            pelaajan1Pisteet.Value += 1; 
     157        } 
     158        else if (kohde == vasenReuna) 
     159        { 
     160            pelaajan2Pisteet.Value += 1; 
     161        } 
    140162    } 
    141163} 
  • 2013/24/NicoL/Pong/Pong/PongContent/PongContent.contentproj

    r4055 r4063  
    4545    <Reference Include="AnimationExtension" /> 
    4646  </ItemGroup> 
     47  <ItemGroup> 
     48    <Compile Include="Maila1.png"> 
     49      <Name>Maila1</Name> 
     50      <Importer>TextureImporter</Importer> 
     51      <Processor>TextureProcessor</Processor> 
     52    </Compile> 
     53  </ItemGroup> 
     54  <ItemGroup> 
     55    <Compile Include="Maila2.png"> 
     56      <Name>Maila2</Name> 
     57      <Importer>TextureImporter</Importer> 
     58      <Processor>TextureProcessor</Processor> 
     59    </Compile> 
     60  </ItemGroup> 
     61  <ItemGroup> 
     62    <Compile Include="Untitled.png"> 
     63      <Name>Untitled</Name> 
     64      <Importer>TextureImporter</Importer> 
     65      <Processor>TextureProcessor</Processor> 
     66    </Compile> 
     67  </ItemGroup> 
    4768  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    4869  <!--  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.