Changeset 7764


Ignore:
Timestamp:
2016-07-05 11:28:55 (3 years ago)
Author:
karkaite
Message:
 
Location:
2016/27/OssiJ/Pong
Files:
1 added
1 deleted
10 edited

Legend:

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

    r7692 r7764  
    44VisualStudioVersion = 14.0.23107.0 
    55MinimumVisualStudioVersion = 10.0.40219.1 
    6 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pong", "Pong\Pong\Pong.csproj", "{4D2DEA42-00A1-43AB-9442-4B0E4D490B2D}" 
     6Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pong", "Pong\Pong\Pong.csproj", "{976BE956-B779-451D-B758-08FF4A5981CE}" 
    77EndProject 
    8 Project("{96E2B04D-8817-42C6-938A-82C39BA4D311}") = "PongContent", "Pong\PongContent\PongContent.contentproj", "{05A01440-01D9-46DE-9E59-9E1E8EF7C959}" 
     8Project("{96E2B04D-8817-42C6-938A-82C39BA4D311}") = "PongContent", "Pong\PongContent\PongContent.contentproj", "{7867D0A9-77AC-4AC7-B0BC-2C33F7299761}" 
    99EndProject 
    1010Global 
     
    1414        EndGlobalSection 
    1515        GlobalSection(ProjectConfigurationPlatforms) = postSolution 
    16                 {4D2DEA42-00A1-43AB-9442-4B0E4D490B2D}.Debug|x86.ActiveCfg = Debug|x86 
    17                 {4D2DEA42-00A1-43AB-9442-4B0E4D490B2D}.Debug|x86.Build.0 = Debug|x86 
    18                 {4D2DEA42-00A1-43AB-9442-4B0E4D490B2D}.Release|x86.ActiveCfg = Release|x86 
    19                 {4D2DEA42-00A1-43AB-9442-4B0E4D490B2D}.Release|x86.Build.0 = Release|x86 
    20                 {05A01440-01D9-46DE-9E59-9E1E8EF7C959}.Debug|x86.ActiveCfg = Debug|x86 
    21                 {05A01440-01D9-46DE-9E59-9E1E8EF7C959}.Release|x86.ActiveCfg = Release|x86 
     16                {976BE956-B779-451D-B758-08FF4A5981CE}.Debug|x86.ActiveCfg = Debug|x86 
     17                {976BE956-B779-451D-B758-08FF4A5981CE}.Debug|x86.Build.0 = Debug|x86 
     18                {976BE956-B779-451D-B758-08FF4A5981CE}.Release|x86.ActiveCfg = Release|x86 
     19                {976BE956-B779-451D-B758-08FF4A5981CE}.Release|x86.Build.0 = Release|x86 
     20                {7867D0A9-77AC-4AC7-B0BC-2C33F7299761}.Debug|x86.ActiveCfg = Debug|x86 
     21                {7867D0A9-77AC-4AC7-B0BC-2C33F7299761}.Release|x86.ActiveCfg = Release|x86 
    2222        EndGlobalSection 
    2323        GlobalSection(SolutionProperties) = preSolution 
  • 2016/27/OssiJ/Pong/Pong/Pong/Pong.cs

    r7720 r7764  
    99public class Pong : PhysicsGame 
    1010{ 
    11     Vector nopeusYlos = new Vector(0. 200); 
    12     Vector nopeusAlas = Vector(0, -200); 
     11    Vector nopeusYlos = new Vector(0, 200); 
     12    Vector nopeusAlas = new Vector(0, -200); 
    1313 
    1414    PhysicsObject pallo; 
    15  
    1615    PhysicsObject maila1; 
    1716    PhysicsObject maila2; 
     17 
     18    IntMeter pelaajan1Pisteet; 
     19    IntMeter pelaajan2Pisteet; 
    1820 
    1921    public override void Begin() 
     
    2123        LuoKentta(); 
    2224        AsetaOhjaimet(); 
     25        LisaaLaskurit(); 
    2326        AloitaPeli(); 
    2427 
    2528 
    26         PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 
    27          
     29        
     30 
    2831    } 
    2932    void LuoKentta() 
    3033    { 
    31          pallo = new PhysicsObject(40.0, 40.0); 
     34        pallo = new PhysicsObject(40.0, 40.0); 
    3235        pallo.Shape = Shape.Circle; 
    3336        Add(pallo); 
     37        AddCollisionHandler(pallo, KasittelePallonTormays); 
    3438        Level.CreateBorders(1.0, false); 
    3539        Level.Background.Color = Color.Black; 
     
    5559        maila.Restitution = 1.0; 
    5660        Add(maila); 
    57         return maila 
     61        return maila; 
    5862    } 
    5963    void AsetaOhjaimet() 
    6064    { 
    61         Keyboard.Listen(Key.A, ButtonState.Down, LiikutaMailaYlos, "Pelaaja 1: Liikuta mailaa ylös") 
    62 Keyboard.Listen(Key.A, ButtonState.Released, PysaytaMaila1, null) 
    63          
    64             Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
     65        Keyboard.Listen(Key.A, ButtonState.Down, AsetaNopeus, "Pelaaja 1: Liikuta mailaa ylös", maila1, nopeusYlos); 
     66        Keyboard.Listen(Key.A, ButtonState.Released, AsetaNopeus, null, maila1, Vector.Zero); 
     67        Keyboard.Listen(Key.Z, ButtonState.Down, AsetaNopeus, "Pelaaja 1: Liikuta mailaa alas", maila1, nopeusAlas); 
     68        Keyboard.Listen(Key.Z, ButtonState.Released, AsetaNopeus, null, maila1, Vector.Zero); 
     69 
     70        Keyboard.Listen(Key.Up, ButtonState.Down, AsetaNopeus, "Pelaaja 2: Liikuta mailaa ylös", maila2, nopeusYlos); 
     71        Keyboard.Listen(Key.Up, ButtonState.Released, AsetaNopeus, null, maila2, Vector.Zero); 
     72        Keyboard.Listen(Key.Down, ButtonState.Down, AsetaNopeus, "Pelaaja 2: Liikuta mailaa alas", maila2, nopeusAlas); 
     73        Keyboard.Listen(Key.Down, ButtonState.Released, AsetaNopeus, null, maila2, Vector.Zero); 
     74 
     75        Keyboard.Listen(Key.F1, ButtonState.Pressed, ShowControlHelp, "Näytä ohjeet"); 
     76        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
    6577    } 
    6678    void AsetaNopeus(PhysicsObject maila, Vector nopeus) 
    6779    { 
     80            if (nopeus.Y < 0 && (maila.Bottom < Level.Bottom)) 
     81        { 
     82            maila.Velocity = Vector.Zero; 
     83            return; 
     84        } 
     85        if (nopeus.Y > 0 && (maila.Top > Level.Top)) 
     86        { 
     87            maila.Velocity = Vector.Zero; 
     88            return; 
     89        } 
    6890        maila.Velocity = nopeus; 
     91    } 
     92    void LisaaLaskurit() 
     93    { 
     94        pelaajan1Pisteet = LuoPisteLaskuri(Screen.Left + 100.0, Screen.Top - 100.0); 
     95        pelaajan2Pisteet = LuoPisteLaskuri(Screen.Right - 100.0, Screen.Top - 100.0); 
     96    } 
     97    IntMeter LuoPisteLaskuri(double x, double y) 
     98    { 
     99        IntMeter laskuri = new IntMeter(0); 
     100        laskuri.MaxValue = 10; 
     101 
     102        Label naytto = new Label(); 
     103        naytto.BindTo(laskuri); 
     104        naytto.X = x; 
     105        naytto.Y = y; 
     106        naytto.TextColor = Color.White; 
     107        naytto.BorderColor = Level.Background.Color; 
     108        naytto.Color = Level.Background.Color; 
     109        Add(naytto); 
     110 
     111        return laskuri; 
     112    } 
     113    { 
     114    void KasittelePallonTormays(PhysicsObject pallo, PhysicsObject kohde) 
    69115} 
  • 2016/27/OssiJ/Pong/Pong/Pong/Pong.csproj

    r7692 r7764  
    22<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
    33  <PropertyGroup> 
    4     <ProjectGuid>{4D2DEA42-00A1-43AB-9442-4B0E4D490B2D}</ProjectGuid> 
     4    <ProjectGuid>{976BE956-B779-451D-B758-08FF4A5981CE}</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>c166092f-ae3b-49fc-9375-9e7713958547</XnaCrossPlatformGroupID> 
     17    <XnaCrossPlatformGroupID>e35f5131-84dd-4c34-b006-8fff9213f24d</XnaCrossPlatformGroupID> 
    1818    <XnaOutputType>Game</XnaOutputType> 
    1919    <ApplicationIcon>Game.ico</ApplicationIcon> 
  • 2016/27/OssiJ/Pong/Pong/Pong/Properties/AssemblyInfo.cs

    r7692 r7764  
    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("4d2dea42-00a1-43ab-9442-4b0e4d490b2d")] 
     25[assembly: Guid("976be956-b779-451d-b758-08ff4a5981ce")] 
    2626 
    2727// Version information for an assembly consists of the following four values: 
  • 2016/27/OssiJ/Pong/Pong/PongContent/PongContent.contentproj

    r7692 r7764  
    22<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
    33  <PropertyGroup> 
    4     <ProjectGuid>{05A01440-01D9-46DE-9E59-9E1E8EF7C959}</ProjectGuid> 
     4    <ProjectGuid>{7867D0A9-77AC-4AC7-B0BC-2C33F7299761}</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.