Changeset 2381


Ignore:
Timestamp:
2011-06-30 15:00:28 (12 years ago)
Author:
jokrhiet
Message:
 
Location:
2011/26/JoelH/THPeli
Files:
9 added
5 edited

Legend:

Unmodified
Added
Removed
  • 2011/26/JoelH/THPeli/THPeli/Peli.cs

    r2310 r2381  
    99public class Peli : PhysicsGame 
    1010{ 
     11    int pMaxMaara = 200; 
     12    ExplosionSystem rajahdys = new ExplosionSystem(LoadImage("explosio"), 500); 
     13     
     14    List<Label> valikonKohdat; 
    1115    const double nopeus = 300; 
    12     const double hyppyNopeus = 900; 
     16    const double hyppyNopeus = 1000; 
    1317    const int RUUDUN_KOKO = 40; 
    1418    PlatformCharacter pelaaja1; 
     
    1721    Image tahtiKuva = LoadImage("tahti"); 
    1822    Image piikkikuva = LoadImage("piikit"); 
     23    Image norsuleft = LoadImage("norsuwalkingleft"); 
     24    Image norsuIdle = LoadImage("norsuidle"); 
     25    Image norsuRight = LoadImage("anothernorsu"); 
    1926    Image splashscreen = LoadImage("Knife's Edge"); 
     27    Image exploosio = LoadImage("explosio"); 
    2028 
    2129    public override void Begin() 
    2230    { 
    23         PhysicsObject splash = new PhysicsObject( 400.0, 400.0 ); 
    24         splash.Shape = Shape.Rectangle; 
    25         splash.Image = splashscreen; 
    26          
     31        Valikko(); 
     32        ExplosionSystem rajahdys = new ExplosionSystem(LoadImage("explosio"), 50); 
     33 
    2734        MediaPlayer.Play("Game Theme"); 
    2835        MediaPlayer.IsRepeating = true; 
     36    } 
     37 
     38    private void alotapeli() 
     39    { 
     40        ClearAll(); 
     41        Keyboard.Listen(Key.Escape, ButtonState.Pressed, Valikko, "Palaa valikkoon"); 
     42 
    2943        Gravity = new Vector(0, -800); 
    3044 
     
    3549        Camera.ZoomFactor = 3.0; 
    3650        Camera.StayInLevel = true; 
     51    } 
     52 
     53 
     54        void Valikko() 
     55    { 
     56        ClearAll(); 
     57        valikonKohdat = new List<Label>(); 
     58        Level.Background.Image = splashscreen; 
     59        Level.BackgroundColor = Color.Black; 
     60        Label kohta1 = new Label("New Game"); 
     61        kohta1.Position = new Vector(0, 40); 
     62        valikonKohdat.Add(kohta1); 
     63 
     64        Label kohta2 = new Label("Exit"); 
     65        kohta2.Position = new Vector(0, -40); 
     66        valikonKohdat.Add(kohta2); 
     67 
     68        foreach (Label valikonKohta in valikonKohdat) 
     69        { 
     70            Add(valikonKohta); 
     71        } 
     72 
     73        Mouse.ListenOn(kohta1, MouseButton.Left, ButtonState.Pressed, alotapeli, null); 
     74        Mouse.ListenOn(kohta2, MouseButton.Left, ButtonState.Pressed, Exit, null); 
     75         
     76        Mouse.IsCursorVisible = true; 
     77        Mouse.ListenMovement(1.0, ValikossaLiikkuminen, null); 
     78        Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, ""); 
     79    } 
     80 
     81    void ValikossaLiikkuminen(AnalogState hiirenTila) 
     82    { 
     83        foreach (Label kohta in valikonKohdat) 
     84        { 
     85            if (Mouse.IsCursorOn(kohta)) 
     86            { 
     87                kohta.TextColor = Color.Green; 
     88            } 
     89            else 
     90            { 
     91                kohta.TextColor = Color.White; 
     92            } 
     93 
     94        } 
    3795    } 
    3896 
     
    47105        Level.CreateBorders(); 
    48106        Level.Background.CreateGradient(Color.Black, Color.Pink); 
     107        IsMouseVisible = false; 
    49108         
    50109    } 
     
    69128        pelaaja1 = new PlatformCharacter(30, 40); 
    70129        pelaaja1.Mass = 10.0; 
    71         pelaaja1.Image = pelaajanKuva; 
     130        pelaaja1.LeftWalkingAnimation = norsuleft; 
     131        pelaaja1.RightWalkingAnimation = norsuRight; 
    72132        AddCollisionHandler(pelaaja1, osuTahteen); 
    73133        return pelaaja1; 
     
    76136 
    77137 
    78  
    79138    void lisaaNappaimet() 
    80139    { 
    81         Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, "Poistu pelistä"); 
    82140 
    83141        Keyboard.Listen(Key.Left, ButtonState.Down, liikuta, "Liikkuu vasemmalle", pelaaja1, -nopeus); 
     
    103161        if (kohde.Tag.ToString() == "tahti") 
    104162        { 
    105             MessageDisplay.Add("Kristalli kerätty!"); 
     163            Add(rajahdys); 
     164            //double X = 0; 
     165            //double Y = 0; 
     166            int pMaara = 600; 
     167            rajahdys.MaxScale = 6; 
     168            rajahdys.MinScale = 1; 
     169            rajahdys.MinLifetime = 0.1; 
     170            rajahdys.MaxLifetime = 0.5; 
     171            rajahdys.AddEffect( kohde.Position, pMaara ); 
     172 
    106173            kohde.Destroy(); 
    107  
     174            MessageDisplay.Add("Keräsit kristallin!!"); 
     175            MessageDisplay.TextColor = Color.White; 
    108176        } 
    109177    } 
  • 2011/26/JoelH/THPeli/THPeli/THPeli.csproj

    r2244 r2381  
    1919    <ApplicationIcon>Game.ico</ApplicationIcon> 
    2020    <Thumbnail>GameThumbnail.png</Thumbnail> 
    21     <PublishUrl>publish\</PublishUrl> 
     21    <IsWebBootstrapper>false</IsWebBootstrapper> 
     22    <ReferencePath>$(registry:HKEY_LOCAL_MACHINE\Software\Jypeli@Install_Dir)\lib\x86</ReferencePath> 
     23    <PublishUrl>C:\MyTemp\JoelH\</PublishUrl> 
    2224    <Install>true</Install> 
    2325    <InstallFrom>Disk</InstallFrom> 
     
    3133    <ApplicationRevision>0</ApplicationRevision> 
    3234    <ApplicationVersion>1.0.0.%2a</ApplicationVersion> 
    33     <IsWebBootstrapper>false</IsWebBootstrapper> 
    3435    <UseApplicationTrust>false</UseApplicationTrust> 
    3536    <BootstrapperEnabled>true</BootstrapperEnabled> 
    36     <ReferencePath>$(registry:HKEY_LOCAL_MACHINE\Software\Jypeli@Install_Dir)\lib\x86</ReferencePath> 
    3737  </PropertyGroup> 
    3838  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> 
     
    116116  </ItemGroup> 
    117117  <ItemGroup> 
     118    <Content Include="explosio.png" /> 
    118119    <Content Include="Game Theme.mp3" /> 
    119120    <Content Include="Game.ico" /> 
     
    122123      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    123124    </Content> 
     125    <Content Include="norsuidle.png" /> 
     126    <Content Include="norsuidlesame.png" /> 
     127    <Content Include="norsuwalkingleft.png" /> 
    124128  </ItemGroup> 
    125129  <ItemGroup> 
  • 2011/26/JoelH/THPeli/THPeli/kentta1.txt

    r2310 r2381  
    1 ############################################################## 
    2                                                              # 
    3                                                              # 
    4                                                              # 
    5        #    ####     *                         *  *  *       # 
    6      ##  #       #########   ### #####  #   # ### #  #       # 
    7         ##     **                                            # 
    8            ## ######                                         # 
    9         ####      *#  *     *    # ###########               # 
    10                  ###  ## ## ###### #        ##               # 
    11    #  #  # #   ###        # #    # #        ####             # 
    12                                  # #        #     #          # 
    13                     *            # #        #    #####       # 
    14                     ##           # #        #                # 
    15                 *                # #        #######          # 
    16                ##                # #               *         # 
    17                                  # #              ####       # 
    18       *               *                            #*        # 
    19       # #         ##  #                         ##           # 
    20   N  ## #  *     ###  #                                    A # 
    21 ####### ############AA###########AAA#######AA################ 
    22                                 #   #     #  # 
    23                                 #   #     #  # 
     1##############################################################                             # 
     2                                                             #                             # 
     3                                                             #                             # 
     4                                                             #                             # 
     5       #    ####     *                         *  *  *       #                             # 
     6     ##  #       #########   ### #####  #   # ### #  #       #                             # 
     7        ##     **                                            #                             # 
     8           ## ######                                                  #                    # 
     9        ####      *#  *     *    # ###########                  ###                        # 
     10                 ###  ## ## ###### #        ##        ########       #                     # 
     11   #  #  # #   ###        # #    # #        ####             #                             # 
     12                                 # #        #     #          #   ##########                # 
     13                    *            # #        #    #####       #                             # 
     14                    ##           # #        #                #                             # 
     15                *                # #        #######          #               **            # 
     16               ##                # #               *         #              #####          # 
     17                                 # #              ####       #           #                 # 
     18      *               *                            #*        #                             # 
     19      # #         ##  #                         ##           #             #               # 
     20  N  ## #  *     ###  #                                      #           ##      *         # 
     21####### ############  ###########   #######  ################         ##         #         # 
     22                                #   #     #  #                               **            # 
     23                                #         #  #                       #############         # 
     24                                                              ###                          # 
     25                        #########       ########    ###      ##                            # 
     26                                                                                           # 
     27                                                                                           # 
     28                                                                                           # 
     29                                                                                           # 
     30                                                                                           # 
     31                                                                                           # 
     32                                                                                           # 
     33                                                                                           # 
     34                                                                                           # 
     35                                                                                           # 
     36                                                                                           # 
     37                                                                                           # 
     38                                                                                           # 
     39                                                                                           # 
     40                                                                                           # 
     41                                                                                           # 
     42                                                                                           # 
     43                                                                                           # 
     44                                                                                           # 
  • 2011/26/JoelH/THPeli/THPeliContent/THPeliContent.contentproj

    r2310 r2381  
    8282    </Compile> 
    8383  </ItemGroup> 
     84  <ItemGroup> 
     85    <Compile Include="norsuidle.png"> 
     86      <Name>norsuidle</Name> 
     87      <Importer>TextureImporter</Importer> 
     88      <Processor>TextureProcessor</Processor> 
     89    </Compile> 
     90  </ItemGroup> 
     91  <ItemGroup> 
     92    <Compile Include="norsuwalkingleft.png"> 
     93      <Name>norsuwalkingleft</Name> 
     94      <Importer>TextureImporter</Importer> 
     95      <Processor>TextureProcessor</Processor> 
     96    </Compile> 
     97  </ItemGroup> 
     98  <ItemGroup> 
     99    <Compile Include="anothernorsu.png"> 
     100      <Name>anothernorsu</Name> 
     101      <Importer>TextureImporter</Importer> 
     102      <Processor>TextureProcessor</Processor> 
     103    </Compile> 
     104  </ItemGroup> 
     105  <ItemGroup> 
     106    <Compile Include="explosio.png"> 
     107      <Name>explosio</Name> 
     108      <Importer>TextureImporter</Importer> 
     109      <Processor>TextureProcessor</Processor> 
     110    </Compile> 
     111  </ItemGroup> 
    84112  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    85113  <!--  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.