- Timestamp:
- 2015-06-10 13:54:17 (7 years ago)
- Location:
- 2015/24/OlaviL/Tasohyppelypeli5
- Files:
-
- 2 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/24/OlaviL/Tasohyppelypeli5/Tasohyppelypeli5/Tasohyppelypeli5/Tasohyppelypeli5.cs
r5954 r6001 15 15 Image olionKuva = LoadImage("gem"); 16 16 17 int pMaxMaara = 200;18 19 17 PlatformCharacter timantti; 20 18 21 22 23 24 25 26 DoubleMeter pistePalkki; 19 int kenttaNro = 1; 27 20 28 21 Image pelaajanKuva = LoadImage("Diamond-02-copy"); … … 34 27 Gravity = new Vector(0, -1000); 35 28 36 LuoKentta( );29 LuoKentta(kentta); 37 30 LisaaNappaimet(); 38 31 LuoPistelaskuri(); 39 32 LuoAikaLaskuri(400.0, 400.0); 40 33 41 42 34 IsFullScreen = true; 43 35 … … 48 40 } 49 41 50 void LuoKentta() 51 { 52 TileMap kentta = TileMap.FromLevelAsset("kentta1"); 53 kentta.SetTileMethod('#', LisaaTaso); 54 kentta.SetTileMethod('*', LisaaTahti); 55 kentta.SetTileMethod('T', LisaaPelaaja); 56 kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 42 void LuoKentta(string kentta) 43 { 44 TileMap ruudut = TileMap.FromLevelAsset("kentta"); 45 ruudut.SetTileMethod('K', LisaaKolikko); 46 ruudut.SetTileMethod('#', LisaaTaso); 47 ruudut.SetTileMethod('*', LisaaTahti); 48 ruudut.SetTileMethod('T', LisaaPelaaja); 49 ruudut.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 57 50 Level.CreateBorders(); 58 51 Level.Background.CreateStars(10000); 59 60 52 Gravity = new Vector(0.0, -800.0); 53 AddCollisionHandler(timantti, "pahis", LisaaRajahdys); 61 54 62 55 } … … 76 69 kolikko.Position = paikka; 77 70 kolikko.Image = tahtiKuva; 78 kolikko.Tag = " tahti";71 kolikko.Tag = "pahis"; 79 72 Add(kolikko); 80 73 } 81 74 75 76 77 void LisaaKolikko(Vector paikka, double leveys, double korkeus) 78 { 79 PhysicsObject tahti = PhysicsObject.CreateStaticObject(leveys, korkeus); 80 tahti.IgnoresCollisionResponse = true; 81 tahti.Position = paikka; 82 tahti.Image = tahtiKuva; 83 tahti.Tag = "paha"; 84 Add(tahti); 85 86 } 82 87 void LisaaPelaaja(Vector paikka, double leveys, double korkeus) 83 88 { … … 86 91 timantti.Mass = 4.0; 87 92 timantti.Image = pelaajanKuva; 88 AddCollisionHandler(timantti, " tahti", TormaaTahteen);93 AddCollisionHandler(timantti, "paha", TormaaTahteen); 89 94 Add(timantti); 95 96 90 97 } 91 98 … … 99 106 Keyboard.Listen(Key.Right, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", timantti, nopeus); 100 107 Keyboard.Listen(Key.Up, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", timantti, hyppyNopeus); 108 Keyboard.Listen(Key.R, ButtonState.Down, AloitaAlusta, "Aloittaa pelin alusta"); 101 109 102 110 ControllerOne.Listen(Button.Back, ButtonState.Pressed, Exit, "Poistu pelistä"); 103 104 111 ControllerOne.Listen(Button.DPadLeft, ButtonState.Down, Liikuta, "Pelaaja liikkuu vasemmalle", timantti, -nopeus); 105 112 ControllerOne.Listen(Button.DPadRight, ButtonState.Down, Liikuta, "Pelaaja liikkuu oikealle", timantti, nopeus); 106 113 ControllerOne.Listen(Button.A, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", timantti, hyppyNopeus); 114 ControllerOne.Listen(Button.X, ButtonState.Down, AloitaAlusta, "Aloittaa pelin alusta"); 115 ControllerOne.Listen(Button.Y, ButtonState.Pressed, Pause, "Pysäyttää pelin"); 107 116 108 117 PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 118 119 120 109 121 } 110 122 … … 116 128 void Hyppaa(PlatformCharacter hahmo, double nopeus) 117 129 { 118 hahmo. ForceJump(nopeus);119 } 120 121 void TormaaTahteen(PhysicsObject hahmo, PhysicsObject kolikko)130 hahmo.Jump(nopeus); 131 } 132 133 void TormaaTahteen(PhysicsObject timantti , PhysicsObject kolikko) 122 134 { 123 135 maaliAani.Play(); 124 136 kolikko.Destroy(); 125 137 pisteLaskuri.Value += 1; 126 127 } 128 138 } 139 140 void AloitaAlusta() 141 { 142 ClearAll(); 143 LuoKentta("kentta"); 144 LisaaNappaimet(); 145 Camera.Follow(timantti); 146 } 129 147 130 148 IntMeter pisteLaskuri; … … 139 157 pisteNaytto.TextColor = Color.Black; 140 158 pisteNaytto.Color = Color.White; 141 pisteNaytto.Title = " Kolikot";159 pisteNaytto.Title = "Tähdet"; 142 160 143 161 144 162 IntMeter keratytEsineet = new IntMeter(0); 145 pisteLaskuri.MaxValue = 51;163 pisteLaskuri.MaxValue = 1; 146 164 pisteLaskuri.UpperLimit += KaikkiKeratty; 147 165 … … 149 167 Add(pisteNaytto); 150 168 151 ProgressBar pistePalkki = new ProgressBar(150, 20); 152 pistePalkki.X = Screen.Left + 150; 153 pistePalkki.Y = Screen.Top - 20; 154 pistePalkki.BindTo(pisteLaskuri); 155 pistePalkki.BarColor = Color.Gold; 156 pistePalkki.Angle = Angle.RightAngle; 157 pistePalkki.Color = Color.HanPurple; 158 Add(pistePalkki); 159 160 161 162 163 164 } 169 } 170 171 172 173 165 174 166 175 167 176 void KaikkiKeratty() 168 177 { 169 MessageDisplay.Add("Pelaaja voitti pelin."); 178 MessageDisplay.Add("Voitit! Nyt voit leikkiä kaikella muulla."); 179 kenttaNro++; 180 SeuraavaKentta(); 170 181 } 171 182 … … 183 194 Add(aikaNaytto); 184 195 } 185 186 187 ExplosionSystem rajahdys = 188 new ExplosionSystem(LoadImage("bomb-157416_640"), 20); 189 190 191 192 193 194 void TormaaTimanttiin(PhysicsObject hahmo, PhysicsObject kolikko) 196 197 198 void LisaaRajahdys(PhysicsObject tormaaja, PhysicsObject kohde) 195 199 { 196 197 } 198 199 200 200 Explosion rajahdys = new Explosion(2000); 201 rajahdys.Position = kohde.Position; 202 kohde.Destroy(); 203 Add(rajahdys); 201 204 } 205 void SeuraavaKentta() 206 { 207 ClearAll(); 208 209 if (kenttaNro == 1) LuoKentta("kentta1"); 210 else if (kenttaNro == 2) LuoKentta("kentta2"); 211 else if (kenttaNro == 3) LuoKentta("kentta3"); 212 else if (kenttaNro > 3) Exit(); 213 214 LisaaNappaimet(); 215 216 } 217 218 219 220 } -
2015/24/OlaviL/Tasohyppelypeli5/Tasohyppelypeli5/Tasohyppelypeli5/Tasohyppelypeli5.csproj.Debug.cachefile
r5954 r6001 2 2 Content\kentta1.xnb 3 3 Content\Diamond-02-copy.xnb 4 Content\coin.xnb 5 Content\yo.xnb 6 Content\bomb-157416_640.xnb 4 Content\kentta2.xnb -
2015/24/OlaviL/Tasohyppelypeli5/Tasohyppelypeli5/Tasohyppelypeli5/obj/x86/Debug/ContentPipeline-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}.xml
r5954 r6001 18 18 <Options>None</Options> 19 19 <Output>C:\MyTemp\OlaviL\Tasohyppelypeli5\Tasohyppelypeli5\Tasohyppelypeli5\bin\x86\Debug\Content\kentta1.xnb</Output> 20 <Time>2015-06- 09T14:31:20.6093193+03:00</Time>20 <Time>2015-06-10T12:46:52.2044209+03:00</Time> 21 21 </Item> 22 22 <Item> … … 30 30 </Item> 31 31 <Item> 32 <Source> coin.jpg</Source>33 <Name> coin</Name>34 <Importer>Text ureImporter</Importer>35 <Processor>Text ureProcessor</Processor>32 <Source>kentta2.txt</Source> 33 <Name>kentta2</Name> 34 <Importer>TextFileImporter</Importer> 35 <Processor>TextFileContentProcessor</Processor> 36 36 <Options>None</Options> 37 <Output>C:\MyTemp\OlaviL\Tasohyppelypeli5\Tasohyppelypeli5\Tasohyppelypeli5\bin\x86\Debug\Content\coin.xnb</Output> 38 <Time>2015-06-09T14:19:50.2592912+03:00</Time> 39 </Item> 40 <Item> 41 <Source>yo.png</Source> 42 <Name>yo</Name> 43 <Importer>TextureImporter</Importer> 44 <Processor>TextureProcessor</Processor> 45 <Options>None</Options> 46 <Output>C:\MyTemp\OlaviL\Tasohyppelypeli5\Tasohyppelypeli5\Tasohyppelypeli5\bin\x86\Debug\Content\yo.xnb</Output> 47 <Time>2015-06-09T14:22:42.1794815+03:00</Time> 48 </Item> 49 <Item> 50 <Source>bomb-157416_640.png</Source> 51 <Name>bomb-157416_640</Name> 52 <Importer>TextureImporter</Importer> 53 <Processor>TextureProcessor</Processor> 54 <Options>None</Options> 55 <Output>C:\MyTemp\OlaviL\Tasohyppelypeli5\Tasohyppelypeli5\Tasohyppelypeli5\bin\x86\Debug\Content\bomb-157416_640.xnb</Output> 56 <Time>2015-06-09T14:47:38.2880774+03:00</Time> 37 <Output>C:\MyTemp\OlaviL\Tasohyppelypeli5\Tasohyppelypeli5\Tasohyppelypeli5\bin\x86\Debug\Content\kentta2.xnb</Output> 38 <Time>2015-06-10T13:38:03.2562209+03:00</Time> 57 39 </Item> 58 40 <BuildSuccessful>true</BuildSuccessful> -
2015/24/OlaviL/Tasohyppelypeli5/Tasohyppelypeli5/Tasohyppelypeli5/obj/x86/Debug/Tasohyppelypeli5.csproj.FileListAbsolute.txt
r5954 r6001 10 10 C:\MyTemp\OlaviL\Tasohyppelypeli5\Tasohyppelypeli5\Tasohyppelypeli5\obj\x86\Debug\Tasohyppelypeli5.pdb 11 11 C:\MyTemp\OlaviL\Tasohyppelypeli5\Tasohyppelypeli5\Tasohyppelypeli5\bin\x86\Debug\Content\Diamond-02-copy.xnb 12 C:\MyTemp\OlaviL\Tasohyppelypeli5\Tasohyppelypeli5\Tasohyppelypeli5\bin\x86\Debug\Content\coin.xnb 13 C:\MyTemp\OlaviL\Tasohyppelypeli5\Tasohyppelypeli5\Tasohyppelypeli5\bin\x86\Debug\Content\yo.xnb 14 C:\MyTemp\OlaviL\Tasohyppelypeli5\Tasohyppelypeli5\Tasohyppelypeli5\bin\x86\Debug\Content\bomb-157416_640.xnb 12 C:\MyTemp\OlaviL\Tasohyppelypeli5\Tasohyppelypeli5\Tasohyppelypeli5\bin\x86\Debug\Content\kentta2.xnb -
2015/24/OlaviL/Tasohyppelypeli5/Tasohyppelypeli5/Tasohyppelypeli5/obj/x86/Debug/cachefile-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}-targetpath.txt
r5954 r6001 2 2 Content\kentta1.xnb 3 3 Content\Diamond-02-copy.xnb 4 Content\coin.xnb 5 Content\yo.xnb 6 Content\bomb-157416_640.xnb 4 Content\kentta2.xnb -
2015/24/OlaviL/Tasohyppelypeli5/Tasohyppelypeli5/Tasohyppelypeli5Content/Tasohyppelypeli5Content.contentproj
r5954 r6001 65 65 </ItemGroup> 66 66 <ItemGroup> 67 <Compile Include="coin.jpg"> 68 <Name>coin</Name> 69 <Importer>TextureImporter</Importer> 70 <Processor>TextureProcessor</Processor> 71 </Compile> 72 </ItemGroup> 73 <ItemGroup> 74 <Compile Include="yo.png"> 75 <Name>yo</Name> 76 <Importer>TextureImporter</Importer> 77 <Processor>TextureProcessor</Processor> 78 </Compile> 79 </ItemGroup> 80 <ItemGroup> 81 <Compile Include="bomb-157416_640.png"> 82 <Name>bomb-157416_640</Name> 83 <Importer>TextureImporter</Importer> 84 <Processor>TextureProcessor</Processor> 67 <Compile Include="kentta2.txt"> 68 <Name>kentta2</Name> 69 <Importer>TextFileImporter</Importer> 70 <Processor>TextFileContentProcessor</Processor> 85 71 </Compile> 86 72 </ItemGroup> -
2015/24/OlaviL/Tasohyppelypeli5/Tasohyppelypeli5/Tasohyppelypeli5Content/kentta1.txt
r5954 r6001 54 54 55 55 * T 56 ## ## T56 ## ## 57 57 ## ## # 58 58 * ## * ## # 59 ###### ## 59 ###### ## T***** # 60 60 ## ############## 61 61 * ## * … … 65 65 ############## ### ### 66 66 ## T ### ### 67 * * ## * * 67 * * ## * * K****************** ##### ##### 68 68 ################## ## ## ## ## ## ##### ##### 69 ## # #70 ***** * ##******* # #69 ## *#* * #* 70 ***** * ##******* *#* * #* 71 71 ######## ###############################################################
Note: See TracChangeset
for help on using the changeset viewer.