Changeset 8990
- Timestamp:
- 2017-07-07 11:15:43 (6 years ago)
- Location:
- 2017/27/OskariK
- Files:
-
- 13 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
2017/27/OskariK/OK/OK/OK/OK.cs
r8966 r8990 23 23 GameObject inventory; //ruutu, jossa kamasi näkyvät 24 24 25 bool potionmeni = false; 26 bool pommimeni = false; 27 25 28 GameObject transition; //ruutu, jolla peli menee eteenpäin 26 29 GameObject voitto; //ruutu, joka tulee kun voitat pelin … … 66 69 void LuoAlue() 67 70 { 68 69 71 Level.Background.Color = Color.White; 70 72 … … 97 99 portrait.X = 750.00; 98 100 portrait.Y = -330.00; 101 portrait.Image = LoadImage("Portretti"); 99 102 Add(portrait); 100 103 … … 134 137 135 138 HP = new IntMeter(65); 139 HP.MaxValue = 65; 136 140 137 141 Label playerHP = new Label(); … … 166 170 void Kontrollit() 167 171 { 172 Keyboard.Clear(); 168 173 Keyboard.Listen(Key.Down, ButtonState.Pressed, AsetaNopeus, "liikkuu", Pointer, nopeusAlas); 169 174 //Keyboard.Listen(Key.Down, ButtonState.Released, AsetaNopeus, null, Pointer, Vector.Zero); … … 192 197 void Items() 193 198 { 199 194 200 pelaajatoiminut = false; 195 inventory = new GameObject 201 inventory = new GameObject(450.0, 300.0); 196 202 command.Shape = Shape.Rectangle; 197 203 inventory.Color = Color.Black; … … 199 205 inventory.Y = -330.00; 200 206 inventory.Image = LoadImage("Items"); 201 Add(inventory); 202 command.Destroy(); 203 204 Keyboard.Listen(Key.X, ButtonState.Pressed, LuoAlue, null); 205 206 207 208 209 } 210 207 Add(inventory, 1); 208 209 Keyboard.Clear(); 210 Keyboard.Listen(Key.Down, ButtonState.Pressed, AsetaNopeus, "liikkuu", Pointer, nopeusAlas); 211 Keyboard.Listen(Key.Up, ButtonState.Pressed, AsetaNopeus, "liikkuu", Pointer, nopeusYlos); 212 Keyboard.Listen(Key.Z, ButtonState.Pressed, Itemvalitse, null); 213 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 214 } 215 216 void Itemvalitse() 217 { 218 if (Pointer.Y > command.Top - command.Height / 3) Potion(); 219 else if (Pointer.Y < command.Bottom + command.Height / 3) poistainventory(); 220 else Bomb(); 221 } 222 223 void poistainventory() 224 225 { 226 Kontrollit(); 227 inventory.Destroy(); 228 } 229 230 231 void Potion() 232 { 233 if (potionmeni) 234 { 235 PlaySound("eipysty"); 236 return; 237 } 238 potionmeni = true; 239 240 pelaajatoiminut = true; 241 242 HP.Value = HP.MaxValue; 243 244 feedtext.Y = textheight - feedtext.Height / 2; 245 feedtext.Text = "Potion recovers your HP. \n" + feedtext.Text; 246 PlaySound("potion"); 247 Kontrollit(); 248 249 switch (vihollisNro) 250 { 251 case 1: 252 if (goopHP > 0) Timer.SingleShot(1.0, Enemy1attack); 253 else Transition(); 254 break; 255 256 case 2: 257 if (skeleHP > 0) Timer.SingleShot(1.0, Enemy2attack); 258 else Transition2(); 259 break; 260 261 case 3: 262 if (snekHP > 0) Timer.SingleShot(1.0, Enemy3attack); 263 else Voitit(); 264 break; 265 266 } 267 268 poistainventory(); 269 } 270 271 void Bomb() 272 { 273 if (pommimeni) 274 { 275 PlaySound("eipysty"); 276 return; 277 } 278 pommimeni = true; 279 280 pelaajatoiminut = true; 281 282 poistainventory(); 283 pelaajatoiminut = true; 284 285 Explosion rajahdys = new Explosion(500); 286 rajahdys.Position = (foe1.Position); 287 Add(rajahdys, 3); 288 289 feedtext.Text = "The bomb explodes! \n" + feedtext.Text; 290 feedtext.Y = textheight - feedtext.Height / 2; 291 292 Timer.SingleShot (3.0, Bomb2); 293 294 } 295 296 void Bomb2() 297 { 298 switch (vihollisNro) 299 { 300 case 1: 301 goopHP.Value -= 20; 302 Transition(); 303 304 break; 305 306 case 2: 307 skeleHP.Value -= 40; 308 Transition2(); 309 310 break; 311 312 case 3: 313 snekHP.Value -= 100; 314 Voitit(); 315 316 break; 317 }; 318 319 } 211 320 void Attack() //mitä tapahtuu jos painaa attackkia 212 321 { … … 405 514 transition.Y = 200.00; 406 515 transition.Image = LoadImage("transiitio"); 407 Add(transition, 3);516 Add(transition, 1); 408 517 409 518 Timer.SingleShot(1.5, Lisaapahis3); … … 446 555 foe3.Y = 200.00; 447 556 foe3.Image = LoadImage("snek"); 448 Add(foe3, 3);557 Add(foe3, 2); 449 558 450 559 pelaajatoiminut = false; -
2017/27/OskariK/OK/OK/OK/OK.csproj.Debug.cachefile
r8966 r8990 12 12 Content\voitto.xnb 13 13 Content\items.xnb 14 Content\Portretti.xnb 15 Content\potion.xnb 16 Content\eipysty.xnb -
2017/27/OskariK/OK/OK/OK/obj/x86/Debug/ContentPipeline-{FF5F8A32-FAE3-40A4-9505-35D2B1C5DB01}.xml
r8966 r8990 119 119 <Time>2017-07-06T13:50:25.6205648+03:00</Time> 120 120 </Item> 121 <Item> 122 <Source>Portretti.png</Source> 123 <Name>Portretti</Name> 124 <Importer>TextureImporter</Importer> 125 <Processor>TextureProcessor</Processor> 126 <Options>None</Options> 127 <Output>C:\MyTemp\OskariK\OK\OK\OK\bin\x86\Debug\Content\Portretti.xnb</Output> 128 <Time>2017-07-07T10:07:09.1703683+03:00</Time> 129 </Item> 130 <Item> 131 <Source>potion.wav</Source> 132 <Name>potion</Name> 133 <Importer>WavImporter</Importer> 134 <Processor>SoundEffectProcessor</Processor> 135 <Options>None</Options> 136 <Output>C:\MyTemp\OskariK\OK\OK\OK\bin\x86\Debug\Content\potion.xnb</Output> 137 <Time>2017-07-07T10:50:40.0251925+03:00</Time> 138 </Item> 139 <Item> 140 <Source>eipysty.wav</Source> 141 <Name>eipysty</Name> 142 <Importer>WavImporter</Importer> 143 <Processor>SoundEffectProcessor</Processor> 144 <Options>None</Options> 145 <Output>C:\MyTemp\OskariK\OK\OK\OK\bin\x86\Debug\Content\eipysty.xnb</Output> 146 <Time>2017-07-07T11:11:19.75973+03:00</Time> 147 </Item> 121 148 <BuildSuccessful>true</BuildSuccessful> 122 149 <Settings> -
2017/27/OskariK/OK/OK/OK/obj/x86/Debug/OK.csproj.FileListAbsolute.txt
r8966 r8990 20 20 C:\MyTemp\OskariK\OK\OK\OK\bin\x86\Debug\Content\voitto.xnb 21 21 C:\MyTemp\OskariK\OK\OK\OK\bin\x86\Debug\Content\items.xnb 22 C:\MyTemp\OskariK\OK\OK\OK\bin\x86\Debug\Content\Portretti.xnb 23 C:\MyTemp\OskariK\OK\OK\OK\bin\x86\Debug\Content\potion.xnb 24 C:\MyTemp\OskariK\OK\OK\OK\bin\x86\Debug\Content\eipysty.xnb -
2017/27/OskariK/OK/OK/OK/obj/x86/Debug/cachefile-{FF5F8A32-FAE3-40A4-9505-35D2B1C5DB01}-targetpath.txt
r8966 r8990 12 12 Content\voitto.xnb 13 13 Content\items.xnb 14 Content\Portretti.xnb 15 Content\potion.xnb 16 Content\eipysty.xnb -
2017/27/OskariK/OK/OK/OKContent/OKContent.contentproj
r8966 r8990 137 137 </Compile> 138 138 </ItemGroup> 139 <ItemGroup> 140 <Compile Include="Portretti.png"> 141 <Name>Portretti</Name> 142 <Importer>TextureImporter</Importer> 143 <Processor>TextureProcessor</Processor> 144 </Compile> 145 </ItemGroup> 146 <ItemGroup> 147 <Compile Include="potion.wav"> 148 <Name>potion</Name> 149 <Importer>WavImporter</Importer> 150 <Processor>SoundEffectProcessor</Processor> 151 </Compile> 152 </ItemGroup> 153 <ItemGroup> 154 <Compile Include="eipysty.wav"> 155 <Name>eipysty</Name> 156 <Importer>WavImporter</Importer> 157 <Processor>SoundEffectProcessor</Processor> 158 </Compile> 159 </ItemGroup> 139 160 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 140 161 <!-- 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.