- Timestamp:
- 2010-07-09 12:47:51 (13 years ago)
- Location:
- 2010/27/heikriin/CrabsAndShrimps
- Files:
-
- 6 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/27/heikriin/CrabsAndShrimps/Content/Content.contentproj
r1203 r1223 41 41 </Compile> 42 42 </ItemGroup> 43 <ItemGroup> 44 <Compile Include="rapu.png"> 45 <Name>rapu</Name> 46 <Importer>TextureImporter</Importer> 47 <Processor>TextureProcessor</Processor> 48 </Compile> 49 </ItemGroup> 50 <ItemGroup> 51 <Compile Include="katkis.png"> 52 <Name>katkis</Name> 53 <Importer>TextureImporter</Importer> 54 <Processor>TextureProcessor</Processor> 55 </Compile> 56 </ItemGroup> 57 <ItemGroup> 58 <Compile Include="rapuiskee.png"> 59 <Name>rapuiskee</Name> 60 <Importer>TextureImporter</Importer> 61 <Processor>TextureProcessor</Processor> 62 </Compile> 63 </ItemGroup> 64 <ItemGroup> 65 <Compile Include="katkisiskee.png"> 66 <Name>katkisiskee</Name> 67 <Importer>TextureImporter</Importer> 68 <Processor>TextureProcessor</Processor> 69 </Compile> 70 </ItemGroup> 71 <ItemGroup> 72 <Compile Include="bang.png"> 73 <Name>bang</Name> 74 <Importer>TextureImporter</Importer> 75 <Processor>TextureProcessor</Processor> 76 </Compile> 77 </ItemGroup> 78 <ItemGroup> 79 <Compile Include="loyh.png"> 80 <Name>loyh</Name> 81 <Importer>TextureImporter</Importer> 82 <Processor>TextureProcessor</Processor> 83 </Compile> 84 </ItemGroup> 43 85 </Project> -
2010/27/heikriin/CrabsAndShrimps/Peli.cs
r1203 r1223 1 1 using System; 2 2 using Jypeli; 3 using Jypeli.Effects; 3 4 using Jypeli.Widgets; 4 5 using Jypeli.Assets; … … 10 11 PlatformCharacter katkis; 11 12 PlatformCharacter rapu; 12 GameObject pannu; 13 GameObject kukka; 13 14 14 15 15 16 IntMeter pisteLaskuri; … … 22 23 AloitaPeli(); 23 24 luoKentta(); 25 26 24 27 25 28 katkis = new PlatformCharacter(220.0, 220.0); … … 28 31 katkis.X = 380.0; 29 32 katkis.Y = -250.0; 33 katkis.Image = LoadImage("katkis"); 34 30 35 31 36 //pannu = new GameObject(500, 500); … … 40 45 rapu.X = -380.0; 41 46 rapu.Y = -200.0; 47 rapu.Image = LoadImage("rapu"); 42 48 43 49 //kukka = new GameObject(500, 500); 44 50 //kukka.Color = Color.Red; 45 51 //rapu.Add(kukka); 52 46 53 47 54 AddCollisionHandler(katkis, katkisTormaa); … … 71 78 Keyboard.Listen(Key.D, ButtonState.Down, liikuta, "Liikkuu oikealle", rapu, 100.0); 72 79 Keyboard.Listen(Key.W, ButtonState.Pressed, hyppaa, "Hyppää", rapu, hyppyVoima); 73 Keyboard.Listen(Key.Q, ButtonState.Pressed, rapuiskee, "Kukka"); 74 } 80 Keyboard.Listen(Key.Q, ButtonState.Pressed, rapuiskee, "Kukka"); 81 82 } 83 84 85 86 75 87 76 88 void katkisiskee() 77 89 { 78 if(katkis.X - rapu.X < 300) 79 { 80 rapuElamat.Value -=3; 90 Image[] katkisKuvat = LoadImages("katkis", "katkisiskee", "katkisiskee", "katkisiskee"); 91 katkis.Animation = new Animation(katkisKuvat); 92 katkis.Animation.Start(1); 93 Vector etaisyys = new Vector(katkis.X - rapu.X, katkis.Y - rapu.Y); 94 if(etaisyys.Magnitude < 300) 95 { 96 rapuElamat.Value -=5; 97 ExplosionSystem rajahdys = new ExplosionSystem(LoadImage("bang"), 1); 98 Add(rajahdys); 99 rajahdys.AddEffect(0, 0, 1); 100 } 101 102 if (rapuElamat.Value <= 0) 103 { 104 LopetusRuutu(); 105 MessageDisplay.Add("KATKIS VOITTI"); 81 106 } 82 107 } … … 84 109 void rapuiskee() 85 110 { 86 if(rapu.X - katkis.X < 300) 87 { 88 katkisElamat.Value -=3; 89 } 111 Image[] rapuKuvat = LoadImages("rapu", "rapuiskee", "rapuiskee", "rapuiskee"); 112 rapu.Animation = new Animation(rapuKuvat); 113 rapu.Animation.Start(1); 114 Vector etaisyys = new Vector(katkis.X - rapu.X, katkis.Y - rapu.Y); 115 if (etaisyys.Magnitude < 300) 116 117 { 118 katkisElamat.Value -=5; 119 120 ExplosionSystem rajahdys = new ExplosionSystem(LoadImage("loyh"), 1); 121 Add(rajahdys); 122 rajahdys.AddEffect(0, 0, 1); 123 124 } 125 126 90 127 91 128 if (katkisElamat.Value <= 0) 92 129 { 93 MessageDisplay.Add("RAPU VOITTI."); 94 } 130 LopetusRuutu(); 131 MessageDisplay.Add("RAPU VOITTI"); 132 } 133 134 95 135 96 136 } … … 156 196 { } 157 197 198 void LopetusRuutu() 199 { 200 ClearAll(); 201 202 MessageDisplay.TextColor = Color.White; 203 MessageDisplay.Position = new Vector(00, 00); 204 205 Keyboard.Listen(Key.V,ButtonState.Pressed, Begin, null); 206 207 208 } 209 210 211 158 212 159 213
Note: See TracChangeset
for help on using the changeset viewer.