Changeset 6974 for 2015/30


Ignore:
Timestamp:
2015-07-23 11:50:21 (8 years ago)
Author:
eekrrint
Message:
 
Location:
2015/30/EemilR
Files:
96 added
4 edited

Legend:

Unmodified
Added
Removed
  • 2015/30/EemilR/Tasohyppelypeli/Tasohyppelypeli/Tasohyppelypeli/Tasohyppelypeli.cs

    r6939 r6974  
    2727    Image Avaimeton2Kuva = LoadImage("Avaimeton2"); 
    2828    Image Avain2Kuva = LoadImage("Avain2"); 
     29    Image pahiksenKuva = LoadImage("Vihollinen1"); 
     30    Image oviVasenKuva = LoadImage("OviVasen"); 
     31    Image paluuOikeaKuva = LoadImage("PaluuOikea"); 
    2932 
    3033    DoubleMeter avaintenmaara; 
     
    3639    PhysicsObject viimeinenCheckpoint; 
    3740 
    38      
     41    bool cheats = false; 
     42 
     43    bool painovoima = true; 
     44 
     45 
    3946 
    4047     
     
    4855 
    4956        IsFullScreen = true; 
    50  
    51         Gravity = new Vector(0, -1000); 
    5257 
    5358        LuoKentta(); 
     
    5560        Asetamittari(); 
    5661        AsetaLaskin(); 
     62        LisaaPainovoima(); 
    5763 
    5864         
     
    6268 
    6369 
     70         
     71    } 
     72 
     73    void LisaaPainovoima() 
     74    { 
     75        if (painovoima == true) 
     76        { 
     77            Gravity = new Vector(0, -1000); 
     78        } 
     79        else 
     80        { 
     81           Gravity = new Vector(0, 0); 
     82        } 
    6483         
    6584    } 
     
    7493        tekstikentta.Y = Screen.Top - 100; 
    7594        tekstikentta.TextColor = Color.Black; 
     95        tekstikentta.Text = tekstikentta + "moimoi"; 
    7696        Add(tekstikentta); 
    7797    } 
     
    102122        kentta.SetTileMethod('C', LisaaCheckpoint); 
    103123        kentta.SetTileMethod('2', LisaaOvi2); 
     124        kentta.SetTileMethod('V', LisaaPahis); 
     125        kentta.SetTileMethod('<', LisaaVasenOvi); 
     126 
     127 
     128        kentta.SetTileMethod('U', LisaaOikeaPaluu); 
     129 
    104130        kentta.Execute(Koko, Koko); 
    105131        Level.CreateBorders(); 
     
    107133 
    108134        PhysicsObject liikkuva1 = new PhysicsObject(200.0, 40.0); 
     135    } 
     136 
     137    void LisaaOikeaPaluu(Vector paikka, double leveys, double korkeus) 
     138    { 
     139        PhysicsObject PaluuOikea = PhysicsObject.CreateStaticObject(leveys, korkeus); 
     140        PaluuOikea.Position = paikka; 
     141        PaluuOikea.Image = paluuOikeaKuva; 
     142        PaluuOikea.IgnoresCollisionResponse = true; 
     143        Add(PaluuOikea); 
     144    } 
     145 
     146    void LisaaVasenOvi(Vector paikka, double leveys, double korkeus) 
     147    { 
     148        PhysicsObject OviVasen = PhysicsObject.CreateStaticObject(leveys, korkeus); 
     149        OviVasen.Position = paikka; 
     150        OviVasen.Image = oviVasenKuva; 
     151        OviVasen.IgnoresCollisionResponse = true; 
     152        Add(OviVasen); 
     153    } 
     154 
     155 
     156    void LisaaPahis(Vector paikka, double leveys, double korkeus) 
     157    { 
     158        PlatformCharacter Pahis = new PlatformCharacter(leveys, korkeus); 
     159        Pahis.Position = paikka; 
     160        Pahis.Image = pahiksenKuva; 
     161        Pahis.Tag = "pahis"; 
     162        Pahis.Shape = Shape.FromImage(pahiksenKuva); 
     163 
     164        PlatformWandererBrain tasoAivot = new PlatformWandererBrain(); 
     165        tasoAivot.Speed = 100; 
     166 
     167        Pahis.Brain = tasoAivot; 
     168        Add(Pahis); 
    109169    } 
    110170 
     
    169229        AddCollisionHandler(pelaaja1, "piikki", osuiPiikkiin); 
    170230        AddCollisionHandler(pelaaja1, "checkpoint", checkpointAktivoitu); 
     231        AddCollisionHandler(pelaaja1, "pahis", osuiPiikkiin); 
    171232        pelaaja1.IgnoresCollisionResponse = false; 
    172233        Add(pelaaja1); 
     
    184245        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
    185246        Keyboard.Listen(Key.R, ButtonState.Pressed, ResetToCheckpoint , "Palaa edelliseen checkpointtiin"); 
     247        Keyboard.Listen(Key.Enter, ButtonState.Pressed, CheatitPaalle, "Enable Cheats"); 
    186248 
    187249        Keyboard.Listen(Key.A, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja1, -nopeus); 
     
    189251        Keyboard.Listen(Key.Space, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", pelaaja1, hyppyNopeus); 
    190252 
     253         
     254 
    191255        ControllerOne.Listen(Button.Back, ButtonState.Pressed, Exit, "Poistu pelistä"); 
    192256 
     
    196260 
    197261        PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 
     262    } 
     263 
     264    void LiikuYlos(PlatformCharacter hahmo, double nopeus) 
     265    { 
     266        pelaaja1.Hit(new Vector(0, 1000)); 
     267    } 
     268 
     269    void LiikuAlas(PlatformCharacter hahmo, double nopeus) 
     270    { 
     271        pelaaja1.Hit(new Vector(0, -1000)); 
     272    } 
     273 
     274    void LiikuOikealle(PlatformCharacter hahmo, double nopeus) 
     275    { 
     276        pelaaja1.Hit(new Vector(4000, 0)); 
     277    } 
     278 
     279    void LiikuVasemmalle(PlatformCharacter hahmo, double nopeus) 
     280    { 
     281        pelaaja1.Hit(new Vector(-4000, 0)); 
    198282    } 
    199283 
     
    233317    } 
    234318 
    235     void osuiPiikkiin(PhysicsObject pelaaja1, PhysicsObject avain) 
     319    void osuiPiikkiin(PhysicsObject pelaaja1, PhysicsObject juttu) 
    236320    { 
    237321        pelaaja1.Position = viimeinenCheckpoint.Position; 
    238322 
    239323        kuolemat.Value += 1; 
     324         
    240325    } 
    241326 
     
    258343            ovi2.Destroy(); 
    259344        } 
     345        else 
     346        { 
     347            MessageDisplay.Add("Sinulla ei ole tarpeeksi avaimia."); 
     348        } 
    260349    } 
    261350     
    262351    void ovenAvaus(PhysicsObject pelaaja1, PhysicsObject ovi) 
    263352    { 
    264         if(avaintenmaara > 0) 
    265         { 
    266          MessageDisplay.Add("Avasit oven"); 
    267          avaintenmaara.Value -= 1; 
    268          ovi.Destroy(); 
    269         } 
    270  
    271     }    
    272  
    273  
     353        if (avaintenmaara > 0) 
     354        { 
     355            MessageDisplay.Add("Avasit oven"); 
     356            avaintenmaara.Value -= 1; 
     357            ovi.Destroy(); 
     358        } 
     359        else 
     360        { 
     361            MessageDisplay.Add("Sinulla ei ole tarpeeksi avaimia."); 
     362        } 
     363 
     364    } 
     365 
     366    void CheatitPaalle() 
     367    { 
     368        InputWindow kysymysIkkuna = new InputWindow("Enter Code To Enable Cheats"); 
     369        kysymysIkkuna.TextEntered += ProcessInput; 
     370        Add( kysymysIkkuna ); 
     371    } 
     372 
     373    void ProcessInput(InputWindow ikkuna) 
     374    { 
     375        string vastaus = ikkuna.InputBox.Text; 
     376        if (vastaus == "1234") 
     377        { 
     378            if (cheats == true) 
     379            { 
     380                cheats = false; 
     381                painovoima = true; 
     382                pelaaja1.IgnoresCollisionResponse = false; 
     383                LisaaPainovoima(); 
     384                Keyboard.Disable(Key.O); 
     385                Keyboard.Disable(Key.K); 
     386                Keyboard.Disable(Key.L); 
     387                Keyboard.Disable(Key.J); 
     388            } 
     389            else 
     390            { 
     391                cheats = true; 
     392                painovoima = false; 
     393                pelaaja1.IgnoresCollisionResponse = true; 
     394                Keyboard.Enable(Key.O); 
     395                Keyboard.Enable(Key.K); 
     396                Keyboard.Enable(Key.L); 
     397                Keyboard.Enable(Key.J); 
     398                Keyboard.Listen(Key.I, ButtonState.Pressed, LiikuYlos, "Ylös", pelaaja1, nopeus); 
     399                Keyboard.Listen(Key.K, ButtonState.Pressed, LiikuAlas, "Alas", pelaaja1, nopeus); 
     400                Keyboard.Listen(Key.L, ButtonState.Pressed, LiikuOikealle, "Oikealle", pelaaja1, nopeus); 
     401                Keyboard.Listen(Key.J, ButtonState.Pressed, LiikuVasemmalle, "Vasemmalle", pelaaja1, nopeus); 
     402                LisaaPainovoima(); 
     403 
     404 
     405            } 
     406        } 
     407    } 
    274408 
    275409    void avaimetTaynna() 
  • 2015/30/EemilR/Tasohyppelypeli/Tasohyppelypeli/Tasohyppelypeli/Tasohyppelypeli.csproj.Debug.cachefile

    r6939 r6974  
    1414Content\Avaimeton2.xnb 
    1515Content\Avain2.xnb 
     16Content\Vihollinen1.xnb 
     17Content\OviVasen.xnb 
     18Content\PaluuOikea.xnb 
  • 2015/30/EemilR/Tasohyppelypeli/Tasohyppelypeli/TasohyppelypeliContent/TasohyppelypeliContent.contentproj

    r6939 r6974  
    138138    </Compile> 
    139139  </ItemGroup> 
     140  <ItemGroup> 
     141    <Compile Include="Vihollinen1.png"> 
     142      <Name>Vihollinen1</Name> 
     143      <Importer>TextureImporter</Importer> 
     144      <Processor>TextureProcessor</Processor> 
     145    </Compile> 
     146  </ItemGroup> 
     147  <ItemGroup> 
     148    <Compile Include="OviVasen.png"> 
     149      <Name>OviVasen</Name> 
     150      <Importer>TextureImporter</Importer> 
     151      <Processor>TextureProcessor</Processor> 
     152    </Compile> 
     153  </ItemGroup> 
     154  <ItemGroup> 
     155    <Compile Include="PaluuOikea.png"> 
     156      <Name>PaluuOikea</Name> 
     157      <Importer>TextureImporter</Importer> 
     158      <Processor>TextureProcessor</Processor> 
     159    </Compile> 
     160  </ItemGroup> 
    140161  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    141162  <!--  To modify your build process, add your task inside one of the targets below and uncomment it.  
  • 2015/30/EemilR/Tasohyppelypeli/Tasohyppelypeli/TasohyppelypeliContent/kentta1.txt

    r6939 r6974  
    1 .............................................................................................................................................................................. 
    2 .............................................................................................................................................................................. 
    3 .............................................................................................................................................................................. 
    4 .............................................................................................................................................................................. 
    5 .............................................................................................................................................................................. 
    6 .............................................................................................................................................................................. 
    7 ...................################........................................................................................................................................................... 
    8 ...................#..............#########............................................................................................................................................. 
    9 ####################......................#..................................................................................................................................... 
    10 #..................#......................#............................................................................................................................. 
    11 #..................#.#.......#....#########............................................................................................................................................. 
    12 #..................#.#.#..........#............................................................................................................................................. 
    13 #..................###...........##............................................................................................................................................. 
    14 #.......#....##....#...........####............................................................................................................................................. 
    15 #.###..............#..#############..................................................................................................................................................... 
    16 #.#.#............###O#####....#####........................................................................................................................................................ 
    17 #A#.#..............#..............#............................................................................................................................................ 
    18 #.#.#........###...########.......#.................................................................................................................................................... 
    19 #.###...#..........#..........#...#................................................................................................................................................ 
    20 #...#..............#..............#.......................................................................................................................................... 
    21 #.N.########.......#..###########A#............................................................................................................................................... 
    22 #.C...........#........#........###................................................................................................................................................ 
    23 #........AAA.......##..2........#................................................................................................................................. 
    24 ######A#######################..#########.......................................................................................................................................................................... 
    25 .....#O#A....................#..........#...................................................................................................................................... 
    26 .....#.#................####.##...#.....#........................................................................................................................................ 
    27 .....#.############........#O#........#.#.................................................................................................................................................... 
    28 .....#.#...........#.......#C..##.....#A#.......................................................................................................................................... 
    29 .....#C#...................#.......#..###......................................................................................................................................... 
    30 .....#.................##..#..........#......................................................................................................................................... 
    31 .....#........PP..PP.......#.........##............................................................................................................................................ 
    32 .....#######################PPP..PPP.A#................................................................................................................................................................ 
    33 ...........................############................................................................................................................................................. 
    34 .............................................................................................................................................................................. 
    35 .............................................................................................................................................................................. 
    36 .............................................................................................................................................................................. 
    37 .............................................................................................................................................................................. 
    38 .............................................................................................................................................................................. 
    39 .............................................................................................................................................................................. 
    40 .............................................................................................................................................................................. 
    41 .............................................................................................................................................................................. 
    42 .............................................................................................................................................................................. 
    43 .............................................................................................................................................................................. 
    44 .............................................................................................................................................................................. 
    45 .............................................................................................................................................................................. 
    46 .............................................................................................................................................................................. 
    47 .............................................................................................................................................................................. 
    48 .............................................................................................................................................................................. 
    49 .............................................................................................................................................................................. 
    50 .............................................................................................................................................................................. 
    51 .............................................................................................................................................................................. 
    52 .............................................................................................................................................................................. 
    53 .............................................................................................................................................................................. 
    54 .............................................................................................................................................................................. 
    55 .............................................................................................................................................................................. 
    56 .............................................................................................................................................................................. 
    57 .............................................................................................................................................................................. 
    58 .............................................................................................................................................................................. 
    59 .............................................................................................................................................................................. 
    60 .............................................................................................................................................................................. 
    61 .............................................................................................................................................................................. 
    62 .............................................................................................................................................................................. 
    63 .............................................................................................................................................................................. 
    64 .............................................................................................................................................................................. 
    65 .............................................................................................................................................................................. 
    66 .............................................................................................................................................................................. 
    67 .............................................................................................................................................................................. 
    68 .............................................................................................................................................................................. 
    69 .............................................................................................................................................................................. 
    70 .............................................................................................................................................................................. 
     1..................................................................................................................................................................................... 
     2..................................................................................................................................................................................... 
     3..................................................................................................................................................................................... 
     4..................................................................................................................................................................................... 
     5..................................................................................................................................................................................... 
     6...................################.......##################.......................................................................................................................................... 
     7...................#..............#########................#......................................................................................................................... 
     8####################......................#..#############.#.......................................................................................................................... 
     9#..................#......................#..............#.#.......................................................................................................................... 
     10#..................#.#.......#....#######O#############..#C#.......................................................................................................................... 
     11#..................#A#.#..........#..................2...#.########......................................................................................................................... 
     12#..................###...........##.########.....#########.#......#.................................................................................................................... 
     13#.......#....##....#...........####.......#.....C#....#....#.#....#..................................................................................................................... 
     14#.###..............#..###################.#....##.....#..###.##...#...................................................................................................................... 
     15#.#.#............###O#####....#####.....#A##..........#......#....#.................................................................................................................... 
     16#A#.#..............#..............#....A###...........#....###...##...................................................................................................................... 
     17#.#.#........###...########.......#.#..#..#...#.......#....###....#.................................................................................................................... 
     18#.###...#..........#..........#...#.......#...........#PP..####...#.................................................................................................................... 
     19#...#..............#..............##......#......#....#....###....#.................................................................................................................... 
     20#.N.########.......#..###########A#.......#...........#....###...##.................................................................................................................... 
     21#.C...........#....#...#........###...#.........V....##A...###....#.................................................................................................................... 
     22#................V.##..2........###PPPP.###############....####...#.................................................................................................................... 
     23######.#######################..#######################..PP###....#.................................................................................................................... 
     24.....#O#A....................#..........#.............#....###...##..................................................................................................................... 
     25.....#.#................####.##...#.....#.............#....###....#.................................................................................................................. 
     26..#..#.############........#O#........#.#.............#....####...#........................................................................................................................ 
     27..#..#.#...........#.......#C..##.....#A#.............#PP..###....#..................................................................................................................... 
     28..#..#C#...................#.......#..###.............#....###...##..................................................................................................................... 
     29..#..#.................##..#..........###.............#....###....#..................................................................................................................... 
     30..#..#........PP..PP.......#.........##...............#....####...#..................................................................................................................... 
     31..#..#######################PPP..PPP.A#...............#..PP###....#..................................................................................................................... 
     32..#........................############...............#....###...##.............................................................................................................. 
     33..#...................................................#....###....#................................................................................................................... 
     34..################....................................#....####...#................................................................................................................... 
     35..#...................................................#PP..###....#................................................................................................................... 
     36..#...................................................#....###....#................................................................................................................... 
     37..#...................................................#....###...##............................................................................................................. 
     38..#...................................................#....###....#............................................................................................................. 
     39..#...................................................#..PP####...#............................................................................................................. 
     40..#...................................................#....###....#............................................................................................................................... 
     41..#...................................................#....###....#............................................................................................................................... 
     42..#...................................................#....###...##............................................................................................................................... 
     43..#...................................................#PP.A###....#............................................................................................................................... 
     44..#...................................................#....####...#............................................................................................................................... 
     45..#...................................................#....###....#............................................................................................................................... 
     46..#...................................................#....###....#............................................................................................................................... 
     47..#...................................................#..PP###...##............................................................................................................................... 
     48..#...................................................#....###....#............................................................................................................................... 
     49..#...................................................#....####...#............................................................................................................................... 
     50..#...................................................#....###....#............................................................................................................................... 
     51..#..........................................##########PP..###....#......................................................................................................................... 
     52..#..........................................#..............##...##.................................................................................................................... 
     53..#..........................................#..............##....#.................................................................................................................... 
     54..#..........................................#..............###...#........................................................................................................................ 
     55..#..........................................#..............##....#......................................................................................................................... 
     56..#..........................................#..............##...##......................................................................................................................... 
     57..#..........................................#..............##...##......................................................................................................................... 
     58..#..........................................#..................###......................................................................................................................... 
     59..#.........................................C2..........V.......###................................................................................................................... 
     60###################################################################................................................................................................................................. 
     61..................................................................................................................................................................................... 
     62..................................................................................................................................................................................... 
     63..................................................................................................................................................................................... 
     64..................................................................................................................................................................................... 
     65..................................................................................................................................................................................... 
     66..................................................................................................................................................................................... 
     67..................................................................................................................................................................................... 
     68..................................................................................................................................................................................... 
     69..................................................................................................................................................................................... 
Note: See TracChangeset for help on using the changeset viewer.