Changeset 7912 for 2016/27


Ignore:
Timestamp:
2016-07-06 15:03:03 (3 years ago)
Author:
sieerinn
Message:
 
Location:
2016/27/DanielL
Files:
99 added
1 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • 2016/27/DanielL/Pong/Pong.sln

    r7689 r7912  
    44VisualStudioVersion = 14.0.23107.0 
    55MinimumVisualStudioVersion = 10.0.40219.1 
    6 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pong", "Pong\Pong\Pong.csproj", "{90A5929D-8C03-4550-AEEC-898A56E8E789}" 
     6Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pong", "Pong\Pong\Pong.csproj", "{8333EC3D-9E45-459E-B5C1-CF76634A51E6}" 
    77EndProject 
    8 Project("{96E2B04D-8817-42C6-938A-82C39BA4D311}") = "PongContent", "Pong\PongContent\PongContent.contentproj", "{A089234C-2A71-4DFB-B61D-9954C5B44A93}" 
     8Project("{96E2B04D-8817-42C6-938A-82C39BA4D311}") = "PongContent", "Pong\PongContent\PongContent.contentproj", "{F1E86E71-654A-454F-83C2-0D4F8DA3F9E3}" 
    99EndProject 
    1010Global 
     
    1414        EndGlobalSection 
    1515        GlobalSection(ProjectConfigurationPlatforms) = postSolution 
    16                 {90A5929D-8C03-4550-AEEC-898A56E8E789}.Debug|x86.ActiveCfg = Debug|x86 
    17                 {90A5929D-8C03-4550-AEEC-898A56E8E789}.Debug|x86.Build.0 = Debug|x86 
    18                 {90A5929D-8C03-4550-AEEC-898A56E8E789}.Release|x86.ActiveCfg = Release|x86 
    19                 {90A5929D-8C03-4550-AEEC-898A56E8E789}.Release|x86.Build.0 = Release|x86 
    20                 {A089234C-2A71-4DFB-B61D-9954C5B44A93}.Debug|x86.ActiveCfg = Debug|x86 
    21                 {A089234C-2A71-4DFB-B61D-9954C5B44A93}.Release|x86.ActiveCfg = Release|x86 
     16                {8333EC3D-9E45-459E-B5C1-CF76634A51E6}.Debug|x86.ActiveCfg = Debug|x86 
     17                {8333EC3D-9E45-459E-B5C1-CF76634A51E6}.Debug|x86.Build.0 = Debug|x86 
     18                {8333EC3D-9E45-459E-B5C1-CF76634A51E6}.Release|x86.ActiveCfg = Release|x86 
     19                {8333EC3D-9E45-459E-B5C1-CF76634A51E6}.Release|x86.Build.0 = Release|x86 
     20                {F1E86E71-654A-454F-83C2-0D4F8DA3F9E3}.Debug|x86.ActiveCfg = Debug|x86 
     21                {F1E86E71-654A-454F-83C2-0D4F8DA3F9E3}.Release|x86.ActiveCfg = Release|x86 
    2222        EndGlobalSection 
    2323        GlobalSection(SolutionProperties) = preSolution 
  • 2016/27/DanielL/Pong/Pong/Pong/Pong.cs

    r7716 r7912  
    1111    Vector nopeusYlos = new Vector(0, 200); 
    1212    Vector nopeusAlas = new Vector(0, -200); 
     13 
    1314    PhysicsObject pallo; 
    14  
    1515    PhysicsObject maila1; 
    1616    PhysicsObject maila2; 
     17 
     18    PhysicsObject vasenReuna; 
     19    PhysicsObject oikeaReuna; 
     20 
     21    IntMeter pelaajan1Pisteet; 
     22    IntMeter pelaajan2Pisteet; 
    1723    public override void Begin() 
    1824    { 
    1925        LuoKentta(); 
    2026        Aloitapeli(); 
     27        LisaaLaskurit(); 
    2128        AsetaOhjaimet(); 
    2229        // TODO: Kirjoita ohjelmakoodisi tähän 
     
    3037        Keyboard.Listen(Key.A, ButtonState.Down, AsetaNopeus, "Pelaaja 1: Liikuta mailaa ylös", maila1, nopeusYlos); 
    3138        Keyboard.Listen(Key.A, ButtonState.Released, AsetaNopeus, null, maila1, Vector.Zero); 
    32  
     39        Keyboard.Listen(Key.Space, ButtonState.Pressed, LisaaPallonNopeutta, null); 
    3340        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
    3441        Keyboard.Listen(Key.Z, ButtonState.Down, AsetaNopeus, "Pelaaja 1: Liikuta mailaa alas", maila1, nopeusAlas); 
    3542        Keyboard.Listen(Key.Z, ButtonState.Released, AsetaNopeus, null, maila1, Vector.Zero); 
     43        Keyboard.Listen(Key.Tab, ButtonState.Released, AloitaAlusta, null); 
    3644 
    3745        Keyboard.Listen(Key.Up, ButtonState.Down, AsetaNopeus, "Pelaaja 2: Liikuta mailaa ylös", maila2, nopeusYlos); 
     
    4351 
    4452    } 
     53 void LisaaPallonNopeutta() 
     54    { 
     55        pallo.Velocity = pallo.Velocity * 2; 
     56    } 
    4557 
    4658    void LuoKentta() 
    4759    { 
    48         pallo = new PhysicsObject(40.0, 40.0); 
     60        pallo = new PhysicsObject(60.0, 60.0); 
    4961        pallo.Shape = Shape.Circle; 
    5062        Add(pallo); 
     
    5264        pallo.Y = 0.0; 
    5365        pallo.Restitution = 1.0; 
     66        pallo.KineticFriction = 0.0; 
     67        pallo.MomentOfInertia = Double.PositiveInfinity; 
    5468        pallo.Color = Color.Green; 
     69        AddCollisionHandler(pallo, KasittelePallonTormays); 
    5570 
    56       maila1 = LuoMaila(Level.Left + 20.0, 0.0); 
    57       maila2 = LuoMaila(Level.Right - 20.0, 0.0); 
     71        maila1 = LuoMaila(Level.Left + 20.0, 0.0); 
     72        maila2 = LuoMaila(Level.Right - 20.0, 0.0); 
    5873 
    59         
    60         Level.CreateBorders(1.0, true); 
     74 
     75        vasenReuna = Level.CreateLeftBorder(); 
     76        vasenReuna.Restitution = 1.0; 
     77        vasenReuna.KineticFriction = 0.0; 
     78        vasenReuna.IsVisible = false; 
     79 
     80        oikeaReuna = Level.CreateRightBorder(); 
     81        oikeaReuna.Restitution = 1.0; 
     82        oikeaReuna.KineticFriction = 0.0; 
     83        oikeaReuna.IsVisible = false; 
     84 
     85        PhysicsObject ylaReuna = Level.CreateTopBorder(); 
     86        ylaReuna.Restitution = 1.0; 
     87        ylaReuna.KineticFriction = 0.0; 
     88        ylaReuna.IsVisible = false; 
     89 
     90        PhysicsObject alaReuna = Level.CreateBottomBorder(); 
     91        alaReuna.Restitution = 1.0; 
     92        alaReuna.KineticFriction = 0.0; 
     93        alaReuna.IsVisible = false; 
     94 
    6195        Level.Background.Color = Color.Black; 
    6296 
     
    90124            return; 
    91125        } 
    92             if ((nopeus.Y < 0) && (maila.Bottom < Level.Bottom)) 
    93             { 
    94                 maila.Velocity = Vector.Zero; 
    95                 return; 
    96             } 
    97             
     126        if ((nopeus.Y < 0) && (maila.Bottom < Level.Bottom)) 
     127        { 
     128            maila.Velocity = Vector.Zero; 
     129            return; 
     130        } 
     131 
    98132 
    99133        maila.Velocity = nopeus; 
     
    109143        return maila; 
    110144    } 
     145    void AloitaAlusta() 
     146    { 
     147        ClearAll(); 
     148        Begin(); 
     149    } 
     150    void LisaaLaskurit() 
     151    { 
     152        pelaajan1Pisteet = LuoPisteLaskuri(Screen.Left + 100.0, Screen.Top - 100.0); 
     153        pelaajan2Pisteet = LuoPisteLaskuri(Screen.Right - 100.0, Screen.Top - 100.0); 
     154    } 
     155 
     156    IntMeter LuoPisteLaskuri(double x, double y) 
     157    { 
     158        IntMeter laskuri = new IntMeter(0); 
     159        laskuri.MaxValue = 10; 
     160 
     161        Label naytto = new Label(); 
     162        naytto.BindTo(laskuri); 
     163        naytto.X = x; 
     164        naytto.Y = y; 
     165        naytto.TextColor = Color.White; 
     166        naytto.BorderColor = Level.Background.Color; 
     167        naytto.Color = Level.Background.Color; 
     168        Add(naytto); 
     169 
     170        return laskuri; 
     171    } 
     172 
     173    void KasittelePallonTormays(PhysicsObject pallo, PhysicsObject kohde) 
     174    { 
     175       if (kohde == oikeaReuna) 
     176        { 
     177            pelaajan1Pisteet.Value += 1; 
     178        } 
     179       else if (kohde == vasenReuna) 
     180        { 
     181            pelaajan2Pisteet.Value += 1; 
     182        } 
     183    } 
     184 
     185 
    111186} 
  • 2016/27/DanielL/Pong/Pong/Pong/Pong.csproj

    r7689 r7912  
    22<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
    33  <PropertyGroup> 
    4     <ProjectGuid>{90A5929D-8C03-4550-AEEC-898A56E8E789}</ProjectGuid> 
     4    <ProjectGuid>{8333EC3D-9E45-459E-B5C1-CF76634A51E6}</ProjectGuid> 
    55    <ProjectTypeGuids>{6D335F3A-9D43-41b4-9D22-F6F17C4BE596};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> 
    66    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 
     
    1515    <XnaPlatform>Windows</XnaPlatform> 
    1616    <XnaProfile>Reach</XnaProfile> 
    17     <XnaCrossPlatformGroupID>4d49b510-9879-4c36-ad12-1d4e88712f33</XnaCrossPlatformGroupID> 
     17    <XnaCrossPlatformGroupID>0b6a2804-5d10-4dbf-92e4-03ff2508d32d</XnaCrossPlatformGroupID> 
    1818    <XnaOutputType>Game</XnaOutputType> 
    1919    <ApplicationIcon>Game.ico</ApplicationIcon> 
  • 2016/27/DanielL/Pong/Pong/Pong/Properties/AssemblyInfo.cs

    r7689 r7912  
    2323// project is exposed to COM. On other platforms, it unique identifies the 
    2424// title storage container when deploying this assembly to the device. 
    25 [assembly: Guid("90a5929d-8c03-4550-aeec-898a56e8e789")] 
     25[assembly: Guid("8333ec3d-9e45-459e-b5c1-cf76634a51e6")] 
    2626 
    2727// Version information for an assembly consists of the following four values: 
  • 2016/27/DanielL/Pong/Pong/PongContent/PongContent.contentproj

    r7689 r7912  
    22<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
    33  <PropertyGroup> 
    4     <ProjectGuid>{A089234C-2A71-4DFB-B61D-9954C5B44A93}</ProjectGuid> 
     4    <ProjectGuid>{F1E86E71-654A-454F-83C2-0D4F8DA3F9E3}</ProjectGuid> 
    55    <ProjectTypeGuids>{96E2B04D-8817-42c6-938A-82C39BA4D311};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> 
    66    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 
Note: See TracChangeset for help on using the changeset viewer.