- Timestamp:
- 2015-07-24 11:29:57 (8 years ago)
- Location:
- 2015/30/JenniN
- Files:
-
- 6 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/30/JenniN/Karkuunomapeli/Karkuunomapeli/Karkuunomapeli/Karkuunomapeli.cs
r6987 r7015 7 7 using Jypeli.Widgets; 8 8 9 public class Karkuunomapeli : PhysicsGame 9 10 // 11 //Skyline 12 // 13 14 public class Skyline : PhysicsGame 10 15 { 11 16 const double nopeus = 200; 12 17 const double hyppyNopeus = 750; 13 18 const int RUUDUN_KOKO = 40; 14 15 19 16 20 PlatformCharacter pelaaja1; 17 18 //Image pelaajanKuva = LoadImage("norsu");19 //Image tahtiKuva = LoadImage("tahti");20 21 21 22 Image hahmonKuva = LoadImage("Uusihahmo"); … … 23 24 Image taustaKuva = LoadImage("tautakuva"); 24 25 Image maalinKuva = LoadImage("KuvaM"); 25 Image Savu = LoadImage("sydänsavu"); 26 27 26 Image paapahiksenKuva = LoadImage("paapahis"); 27 Image tausta = LoadImage("tausta"); 28 28 SoundEffect maaliAani = LoadSoundEffect("maali"); 29 //AssaultRifle esteenAse; 30 31 32 33 public override void Begin() 29 30 public override void Begin() 34 31 { 35 32 Gravity = new Vector(0, -1000); … … 39 36 LuoPistelaskuri(); 40 37 41 42 43 44 45 46 Level.Background.Image = taustaKuva; 38 Level.Background.Image = tausta; 47 39 48 40 Camera.Follow(pelaaja1); 49 41 Camera.ZoomFactor = 5; 50 42 Camera.StayInLevel = true; 51 52 53 43 54 44 } 55 45 … … 64 54 kentta.SetTileMethod('M', LisaaMaali); 65 55 kentta.SetTileMethod('U', Lisaakukka); 56 kentta.SetTileMethod('P', LisaaPaaPahis); 66 57 67 58 kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); … … 69 60 Level.Background.CreateGradient(Color.Mint, Color.Turquoise); 70 61 } 71 72 73 62 74 63 //Tasot, joiden päälle voi hyppiä. … … 80 69 Add(taso); 81 70 } 82 83 84 71 85 72 void LisaaSiirtojuttu(Vector paikka, double leveys, double korkeus) … … 102 89 } 103 90 91 void LisaaPaaPahis(Vector paikka, double leveys, double korkeus) 92 { 93 PlatformCharacter paapahis = new PlatformCharacter(60.0, 60.0); 94 paapahis.Image = paapahiksenKuva; 95 Add(paapahis); 96 97 PlatformWandererBrain tasoAivot = new PlatformWandererBrain(); 98 tasoAivot.Speed = 100; 99 paapahis.Tag = "paapahis"; 100 paapahis.Position = paikka; 101 paapahis.Brain = tasoAivot; 102 } 104 103 105 104 //Namut, jotka pitää napata. … … 118 117 { 119 118 PhysicsObject kukka = PhysicsObject.CreateStaticObject(leveys, korkeus); 120 121 119 kukka.Position = paikka; 122 120 kukka.Shape = Shape.Heart; … … 133 131 pelaaja1.Image = hahmonKuva; 134 132 pelaaja1.Tag = "pelaaja"; 133 135 134 AddCollisionHandler(pelaaja1, "tahti", TormaaTahteen); 136 135 AddCollisionHandler(pelaaja1, "este", TormaaEsteeseen); 137 136 AddCollisionHandler(pelaaja1, "maali", MaaliinTulo); 138 137 AddCollisionHandler(pelaaja1, "kukka", TormaaKukkaan); 138 AddCollisionHandler(pelaaja1, "paapahis", TormaaPaaPahikseen); 139 139 Add(pelaaja1); 140 140 } … … 142 142 void TormaaKukkaan(PhysicsObject hahmo, PhysicsObject kukka) 143 143 { 144 Flame liekki = new Flame( Savu);144 Flame liekki = new Flame(paapahiksenKuva); 145 145 liekki.Position = kukka.Position; 146 146 Timer.SingleShot(1.0, delegate { liekki.Destroy(); }); 147 147 Add(liekki); 148 149 148 } 150 149 … … 155 154 Add(liekki); 156 155 Timer.SingleShot(1.0, delegate { hahmo.Destroy(); }); 157 158 156 159 157 Label tekstikentta = new Label(200.0, 100.0, "MAALI!"); … … 162 160 tekstikentta.TextColor = Color.Red; 163 161 tekstikentta.BorderColor = Color.Black; 164 Add(tekstikentta); 165 162 Add(tekstikentta); 166 163 } 167 164 … … 175 172 este.Tag = "este"; 176 173 AssaultRifle esteenAse = new AssaultRifle(leveys, korkeus); 177 178 174 esteenAse.Ammo.Value = 100; 179 175 esteenAse.FireRate = 10; 180 176 esteenAse.X = 30.0; 181 177 esteenAse.Y = -5.0; 182 183 178 esteenAse.ProjectileCollision = AmmusOsui; 184 179 este.Add(esteenAse); … … 192 187 ajastin.Interval = 1.5; 193 188 ajastin.Timeout += delegate { EsteAmpuuAseella(esteenAse); }; 194 ajastin.Start(); 195 196 189 ajastin.Start(); 197 190 } 198 191 … … 200 193 { 201 194 PhysicsObject ammus = ase.Shoot(); 202 203 195 if (ammus != null) 204 196 { 205 197 Timer.SingleShot(0.5, delegate { ammus.Destroy(); }); 206 //ammus.Size *= 3;207 //ammus.Image = ...208 //ammus.MaximumLifetime = TimeSpan.FromSeconds(2.0);209 198 } 210 199 … … 219 208 Timer.SingleShot(5.0, delegate { savu.Destroy(); }); 220 209 pisteLaskuri.Value -= 1; 221 222 210 Add(savu); 223 211 } 224 //ammus.Destroy();225 212 } 226 213 … … 231 218 Keyboard.Listen(Key.F1, ButtonState.Pressed, ShowControlHelp, "Näytä ohjeet"); 232 219 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 233 234 220 Keyboard.Listen(Key.Left, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja1, -nopeus); 235 221 Keyboard.Listen(Key.Right, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja1, nopeus); 236 222 Keyboard.Listen(Key.Up, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", pelaaja1, hyppyNopeus); 237 238 223 ControllerOne.Listen(Button.Back, ButtonState.Pressed, Exit, "Poistu pelistä"); 239 240 224 ControllerOne.Listen(Button.DPadLeft, ButtonState.Down, Liikuta, "Pelaaja liikkuu vasemmalle", pelaaja1, -nopeus); 241 225 ControllerOne.Listen(Button.DPadRight, ButtonState.Down, Liikuta, "Pelaaja liikkuu oikealle", pelaaja1, nopeus); 242 226 ControllerOne.Listen(Button.A, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", pelaaja1, hyppyNopeus); 243 244 227 PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 245 228 } … … 261 244 tahti.Destroy(); 262 245 pisteLaskuri.Value += 1; 263 264 246 } 265 247 … … 275 257 tekstikentta.TextColor = Color.Red; 276 258 tekstikentta.BorderColor = Color.Black; 277 Add(tekstikentta); 278 279 280 281 } 282 283 259 Add(tekstikentta); 260 } 261 262 void TormaaPaaPahikseen(PhysicsObject hahmo, PhysicsObject paapahis) 263 264 { 265 Explosion rajahdys = new Explosion(100); 266 rajahdys.Position = hahmo.Position; 267 Add(rajahdys); 268 hahmo.Destroy(); 269 Label tekstikentta = new Label(200.0, 100.0, "HÄVISIT!"); 270 tekstikentta.Font = Font.DefaultLarge; 271 tekstikentta.Color = Color.Aqua; 272 tekstikentta.TextColor = Color.Red; 273 tekstikentta.BorderColor = Color.Black; 274 Add(tekstikentta); 275 } 284 276 285 277 IntMeter pisteLaskuri; … … 297 289 pisteNaytto.Font = Font.DefaultLarge; 298 290 pisteNaytto.BindTo(pisteLaskuri); 299 Add(pisteNaytto); 300 301 291 Add(pisteNaytto); 302 292 } 303 293 -
2015/30/JenniN/Karkuunomapeli/Karkuunomapeli/Karkuunomapeli/Karkuunomapeli.csproj.Debug.cachefile
r6987 r7015 12 12 Content\KuvaM.xnb 13 13 Content\sydÀnsavu.xnb 14 Content\paapahis.xnb 15 Content\tausta.xnb -
2015/30/JenniN/Karkuunomapeli/Karkuunomapeli/Karkuunomapeli/Ohjelma.cs
r6839 r7015 6 6 static void Main(string[] args) 7 7 { 8 using ( Karkuunomapeli game = new Karkuunomapeli())8 using (Skyline game = new Skyline()) 9 9 { 10 10 #if !DEBUG -
2015/30/JenniN/Karkuunomapeli/Karkuunomapeli/Karkuunomapeli/obj/x86/Debug/Karkuunomapeli.csproj.FileListAbsolute.txt
r6987 r7015 20 20 C:\MyTemp\JenniN\Karkuunomapeli\Karkuunomapeli\Karkuunomapeli\bin\x86\Debug\Content\KuvaM.xnb 21 21 C:\MyTemp\JenniN\Karkuunomapeli\Karkuunomapeli\Karkuunomapeli\bin\x86\Debug\Content\sydÀnsavu.xnb 22 C:\MyTemp\JenniN\Karkuunomapeli\Karkuunomapeli\Karkuunomapeli\bin\x86\Debug\Content\paapahis.xnb 23 C:\MyTemp\JenniN\Karkuunomapeli\Karkuunomapeli\Karkuunomapeli\bin\x86\Debug\Content\tausta.xnb -
2015/30/JenniN/Karkuunomapeli/Karkuunomapeli/Karkuunomapeli/obj/x86/Debug/cachefile-{935D6C79-42D8-4967-8F2D-48E6CFE7CE27}-targetpath.txt
r6987 r7015 12 12 Content\KuvaM.xnb 13 13 Content\sydÀnsavu.xnb 14 Content\paapahis.xnb 15 Content\tausta.xnb -
2015/30/JenniN/Karkuunomapeli/Karkuunomapeli/KarkuunomapeliContent/KarkuunomapeliContent.contentproj
r6987 r7015 132 132 </Compile> 133 133 </ItemGroup> 134 <ItemGroup> 135 <Compile Include="paapahis.png"> 136 <Name>paapahis</Name> 137 <Importer>TextureImporter</Importer> 138 <Processor>TextureProcessor</Processor> 139 </Compile> 140 </ItemGroup> 141 <ItemGroup> 142 <Compile Include="tausta.png"> 143 <Name>tausta</Name> 144 <Importer>TextureImporter</Importer> 145 <Processor>TextureProcessor</Processor> 146 </Compile> 147 </ItemGroup> 134 148 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 135 149 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2015/30/JenniN/Karkuunomapeli/Karkuunomapeli/KarkuunomapeliContent/kentta1.txt
r6987 r7015 1 ############U.. ........E...............*....E......U*.............E......*............*.......#.........E.......*....2 . ......................#...*.........U##...###.....######.......####...####U..........*.......E.........#...#U#######3 *.. .*....######....##########......####...##*##....#...E....##....#.............K.....#....#.##....##..UU........K..*4 #...######.. ..#...*#...#....K............#U.......KU...#.*..#*..###.......*...####.......#...#K.##......K..##...##.##5 #K.......##...######...# .....###.......*##K.....####...####U#####.......#U##...#....#U#.......K...E.....U#...........6 ####U.....U ............#..........*....##..###.......*.K............###........E..............K..*##**..K.......K#UUU7 *...##...## .......#*...#K..*.....###...###..........##########.....E..K........###U######U##U########UUU#***#UUU#####8 ##...E...#..... .#####..#####...........##..............#*.........######....###.....*...........*..#K...**U**....***#9 ..#.########...........#....####...###.#####*...###########........*#......*......##U#.....###U....#K..**...***....*#10 ...#... .......###U#....#...................######......#.....K..#####.....###.........U...##.......#..***#U#.***...*#11 ...........*...........#........###......#.............E...###......#..........#U#K..............*.#.*#.*****.***...#12 ...........##........*.E................*E.........#####....##U....*#......*.....##.....U##......#.#..####.##########13 ..... ....##..#.......###.....###.......#U#.............#.....*##....#....#####....U##..........#...##****#....***..MM14 N.......##K......U####.......*....##########K......*...#..####K.....E....K.........*##....####..K..#*****#....***..MM1 ############U..*.......E........*......*....E......UK.*..*..*......E......*......*.....*.......#....*....E.......*...P 2 .*....*.....*......*...#...*.........U##..*###.....######.......####...####U.*.....*..*....*..E..*......#...#U####### 3 *..*....*######....######U###...*..####...##*##....#...E....##....#...*.........K.....#....#.##....##..UU...*...K..** 4 #...######..*.#...*#*..#*...K........*...#U.......KU...#.*..#*..###.......*...####....*..#...#K.##......K..##...##*## 5 #K.......##...######...#*....###.......*##K..*..####..#####U#####....*..#U##...#....#U#.......K...E.....U#.*.......** 6 ####U.....U#.....*E...##.....*.E..*....##UU###....*..*.K....*...*...###........E.*...*...*..*PK..*##**..K.*..U*..**.* 7 *...##...##*.#*...#*...#K..*...E.###...###..*.*.....##########.....E..K...*....###U##################UUU#U#*U#######U 8 ##...E...#.....U#U###..#####...E.......##K.*......*...*#*.........######....###.....*.......*E..*..#K...**U**....***# 9 *.#*########....*......#*...####...###.#####*...U#####U####.....*..*#*..*..*E..*..##U#*....###U....#U..**...***....*# 10 ...#...*......###U#....#.*......E*....*...K######......#.....K..#####..*..###.........U...##..*....#*.***#U#.***...*# 11 N.....*....*....*......#..*.....###......#...*.......*.E...###...*..K....*..E..#U#K......E*......*.#**#******P******# 12 ####.......##........*.E...*..*E........*E.*...*...#####.*..##U....*#...*..*E....##.....U##....*.#.#**####.########## 13 .....*...##..#.......###....*###.....*.#U#.......*.....#..*..*##....#*...#####....U##.....E*...#...##****#....***..MM 14 K......*##K......U####K......*....##U#######K..*...*..P#*.####K.*.*.E..*.K..*..*..P*##P.*.####..K..#****P#....***..MM 15 15 ##################################################################################################################### 16 16 ##################################################################################################################### -
2015/30/JenniN/Karkuunomapeli/Karkuunomapeli/KarkuunomapeliContent/obj/x86/Debug/ContentPipeline.xml
r6987 r7015 36 36 <Options>None</Options> 37 37 <Output>C:\MyTemp\JenniN\Karkuunomapeli\Karkuunomapeli\Karkuunomapeli\bin\x86\Debug\Content\kentta1.xnb</Output> 38 <Time>2015-07-2 3T14:58:55.2301835+03:00</Time>38 <Time>2015-07-24T11:25:32.2420339+03:00</Time> 39 39 </Item> 40 40 <Item> … … 119 119 <Time>2015-07-23T14:57:41.6347835+03:00</Time> 120 120 </Item> 121 <Item> 122 <Source>paapahis.png</Source> 123 <Name>paapahis</Name> 124 <Importer>TextureImporter</Importer> 125 <Processor>TextureProcessor</Processor> 126 <Options>None</Options> 127 <Output>C:\MyTemp\JenniN\Karkuunomapeli\Karkuunomapeli\Karkuunomapeli\bin\x86\Debug\Content\paapahis.xnb</Output> 128 <Time>2015-07-24T09:54:31.4417339+03:00</Time> 129 </Item> 130 <Item> 131 <Source>tausta.png</Source> 132 <Name>tausta</Name> 133 <Importer>TextureImporter</Importer> 134 <Processor>TextureProcessor</Processor> 135 <Options>None</Options> 136 <Output>C:\MyTemp\JenniN\Karkuunomapeli\Karkuunomapeli\Karkuunomapeli\bin\x86\Debug\Content\tausta.xnb</Output> 137 <Time>2015-07-24T11:10:16.9794339+03:00</Time> 138 </Item> 121 139 <BuildSuccessful>true</BuildSuccessful> 122 140 <Settings>
Note: See TracChangeset
for help on using the changeset viewer.