Changeset 8959 for 2017/27/OskariK/OK
- Timestamp:
- 2017-07-06 12:00:40 (4 years ago)
- Location:
- 2017/27/OskariK/OK
- Files:
-
- 6 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
2017/27/OskariK/OK/OK/OK/OK.cs
r8933 r8959 18 18 double textheight = -220; 19 19 double textwidth = -750; 20 GameObject transition; //ruutu, jolla peli menee eteenpäin 20 21 21 22 PhysicsObject Pointer; //jolla valitaan schaibaa … … 24 25 25 26 IntMeter goopHP; //ekan vihollisen hp 27 IntMeter skeleHP; //tokan vihollisen hp 26 28 IntMeter HP; //pelaajan hp 27 29 int playerdamage = 10; //pelaajan papu 28 30 int enemy1damage = 5; //ekan vihollisen tehot 29 30 Label foeHP; 31 int enemy2damage = 20; //tokan vihollisen tehot 32 33 Label foeHP; // eka vihu 34 Label foe2HP; //toka vihu 31 35 Label playerHP; 32 36 Label feedtext; … … 107 111 goopHP = new IntMeter(20); 108 112 109 LabelfoeHP = new Label();113 foeHP = new Label(); 110 114 111 115 foeHP.X = 150.00; … … 128 132 playerHP.BindTo(HP); 129 133 Add(playerHP, 2); 134 135 skeleHP = new IntMeter(40); 130 136 131 137 … … 179 185 180 186 void Attack() //mitä tapahtuu jos painaa attackkia 187 { 188 if (goopHP.Value > 0) attackenemy1(); 189 else if (skeleHP.Value > 0) attackenemy2(); 190 } 191 192 void attackenemy1() 181 193 { 182 194 goopHP.Value -= playerdamage; … … 205 217 } 206 218 219 void attackenemy2() 220 { 221 skeleHP.Value -= playerdamage; 222 223 GameObject hit = new GameObject(100.00, 100.00); 224 hit.Shape = Shape.Star; 225 hit.Color = Color.OrangeRed; 226 hit.X = 0.00; 227 hit.Y = Screen.Top - 60.00; 228 Add(hit, 3); 229 hit.Image = LoadImage("hitanim2"); 230 hit.MaximumLifetime = new TimeSpan(0, 0, 0, 0, 50); 231 232 PlaySound("hit"); 233 234 GameObject hit2 = new GameObject(100.00, 100.00); 235 hit2.Shape = Shape.Star; 236 hit2.Color = Color.OrangeRed; 237 hit2.X = 0.00; 238 hit2.Y = Screen.Top - 60.00; 239 hit2.Image = LoadImage("hitanim"); 240 hit2.MaximumLifetime = new TimeSpan(0, 0, 0, 0, 100); 241 Add(hit2, 3); 242 243 Attackfeed(playerdamage); 244 } 245 207 246 void Attackfeed(double damage) //combat login tiedot päivittyy 208 247 { … … 214 253 if (goopHP == 0) Transition(); 215 254 216 ajastin = new Timer(); 217 ajastin.Interval = 1.00; 218 ajastin.Timeout += Enemy1attack; 219 ajastin.Start(); 255 if (goopHP == 0) return; 256 257 if (goopHP > 0) Timer.SingleShot(1.0, Enemy1attack); 258 259 else if (skeleHP > 0) Timer.SingleShot(1.0, Enemy2attack); 220 260 } 221 261 … … 224 264 { 225 265 PlaySound("playertakesdamage"); 226 227 266 HP.Value -= enemy1damage; 228 267 … … 232 271 feedtext.Text = "Received " + enemy1damage + " damage.\n" + feedtext.Text; 233 272 feedtext.Y = textheight - feedtext.Height / 2; 234 feedtext.X = textwidth; 235 236 ajastin.Stop(); 273 feedtext.X = textwidth;; 237 274 238 275 pelaajatoiminut = false; … … 240 277 if (HP == 0) Lose(); 241 278 } 279 280 void Enemy2attack() 281 { 282 PlaySound("playertakesdamage"); 283 HP.Value -= enemy2damage; 284 285 double y = feedtext.Y; 286 double x = feedtext.X; 287 288 feedtext.Text = "Received " + enemy2damage + " damage.\n" + feedtext.Text; 289 feedtext.Y = textheight - feedtext.Height / 2; 290 feedtext.X = textwidth; ; 291 292 pelaajatoiminut = false; 293 294 if (HP == 0) Lose(); 295 } 242 296 243 297 void Transition() //pelin siirtyminen eteenpäin, kun pahis voitettu 244 298 { 245 //return Enemy1attack(); 299 foeHP.Destroy(); 300 301 transition = new GameObject(1800.00, 700.00); 302 transition.Shape = Shape.Rectangle; 303 transition.Color = Color.Aqua; 304 transition.X = -10.00; 305 transition.Y = 200.00; 306 transition.Image = LoadImage("transiitio"); 307 Add(transition); 308 309 Timer.SingleShot(1.5, Lisaapahis2); 310 } 311 312 void Lisaapahis2() 313 { 314 foe2 = new GameObject(1800.00, 700.00); 315 foe2.Shape = Shape.Rectangle; 316 foe2.Color = Color.Aqua; 317 foe2.X = -10.00; 318 foe2.Y = 200.00; 319 foe2.Image = LoadImage("luumies"); 320 Add(foe2); 321 322 pelaajatoiminut = false; 323 324 skeleHP = new IntMeter(40); 325 326 foeHP = new Label(); 327 328 foeHP.X = 150.00; 329 foeHP.Y = Screen.Top - 40.00; 330 foeHP.TextColor = Color.Red; 331 foeHP.Color = Color.Transparent; 332 Add(foeHP); 333 334 foeHP.BindTo(skeleHP); 335 Add(foeHP, 3); 336 246 337 } 247 338 … … 249 340 { 250 341 pelaajatoiminut = true; 342 251 343 tappio = new GameObject(Screen.Width, Screen.Height); 252 344 tappio.Shape = Shape.Rectangle; -
2017/27/OskariK/OK/OK/OK/OK.csproj.Debug.cachefile
r8933 r8959 7 7 Content\playertakesdamage.xnb 8 8 Content\hÀviö.xnb 9 Content\transiitio.xnb 10 Content\luumies.xnb 11 Content\snek.xnb -
2017/27/OskariK/OK/OK/OK/obj/x86/Debug/ContentPipeline-{FF5F8A32-FAE3-40A4-9505-35D2B1C5DB01}.xml
r8933 r8959 27 27 <Options>None</Options> 28 28 <Output>C:\MyTemp\OskariK\OK\OK\OK\bin\x86\Debug\Content\hit.xnb</Output> 29 <Time>2017-07-0 5T09:58:42.715538+03:00</Time>29 <Time>2017-07-06T09:22:10.1152246+03:00</Time> 30 30 </Item> 31 31 <Item> … … 73 73 <Output>C:\MyTemp\OskariK\OK\OK\OK\bin\x86\Debug\Content\häviö.xnb</Output> 74 74 <Time>2017-07-05T14:44:05.4250123+03:00</Time> 75 </Item> 76 <Item> 77 <Source>transiitio.png</Source> 78 <Name>transiitio</Name> 79 <Importer>TextureImporter</Importer> 80 <Processor>TextureProcessor</Processor> 81 <Options>None</Options> 82 <Output>C:\MyTemp\OskariK\OK\OK\OK\bin\x86\Debug\Content\transiitio.xnb</Output> 83 <Time>2017-07-06T09:59:19.2803713+03:00</Time> 84 </Item> 85 <Item> 86 <Source>luumies.png</Source> 87 <Name>luumies</Name> 88 <Importer>TextureImporter</Importer> 89 <Processor>TextureProcessor</Processor> 90 <Options>None</Options> 91 <Output>C:\MyTemp\OskariK\OK\OK\OK\bin\x86\Debug\Content\luumies.xnb</Output> 92 <Time>2017-07-06T10:05:13.297384+03:00</Time> 93 </Item> 94 <Item> 95 <Source>snek.png</Source> 96 <Name>snek</Name> 97 <Importer>TextureImporter</Importer> 98 <Processor>TextureProcessor</Processor> 99 <Options>None</Options> 100 <Output>C:\MyTemp\OskariK\OK\OK\OK\bin\x86\Debug\Content\snek.xnb</Output> 101 <Time>2017-07-06T11:07:38.8330604+03:00</Time> 75 102 </Item> 76 103 <BuildSuccessful>true</BuildSuccessful> -
2017/27/OskariK/OK/OK/OK/obj/x86/Debug/OK.csproj.FileListAbsolute.txt
r8933 r8959 15 15 C:\MyTemp\OskariK\OK\OK\OK\bin\x86\Debug\Content\playertakesdamage.xnb 16 16 C:\MyTemp\OskariK\OK\OK\OK\bin\x86\Debug\Content\hÀviö.xnb 17 C:\MyTemp\OskariK\OK\OK\OK\bin\x86\Debug\Content\transiitio.xnb 18 C:\MyTemp\OskariK\OK\OK\OK\bin\x86\Debug\Content\luumies.xnb 19 C:\MyTemp\OskariK\OK\OK\OK\bin\x86\Debug\Content\snek.xnb -
2017/27/OskariK/OK/OK/OK/obj/x86/Debug/cachefile-{FF5F8A32-FAE3-40A4-9505-35D2B1C5DB01}-targetpath.txt
r8933 r8959 7 7 Content\playertakesdamage.xnb 8 8 Content\hÀviö.xnb 9 Content\transiitio.xnb 10 Content\luumies.xnb 11 Content\snek.xnb -
2017/27/OskariK/OK/OK/OKContent/OKContent.contentproj
r8933 r8959 102 102 </Compile> 103 103 </ItemGroup> 104 <ItemGroup> 105 <Compile Include="transiitio.png"> 106 <Name>transiitio</Name> 107 <Importer>TextureImporter</Importer> 108 <Processor>TextureProcessor</Processor> 109 </Compile> 110 </ItemGroup> 111 <ItemGroup> 112 <Compile Include="luumies.png"> 113 <Name>luumies</Name> 114 <Importer>TextureImporter</Importer> 115 <Processor>TextureProcessor</Processor> 116 </Compile> 117 </ItemGroup> 118 <ItemGroup> 119 <Compile Include="snek.png"> 120 <Name>snek</Name> 121 <Importer>TextureImporter</Importer> 122 <Processor>TextureProcessor</Processor> 123 </Compile> 124 </ItemGroup> 104 125 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 105 126 <!-- 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.