Changeset b2d7893 in lost-haven for main/Creature.java
- Timestamp:
- Feb 20, 2021, 6:43:24 PM (4 years ago)
- Branches:
- master
- Children:
- 4d8825f
- Parents:
- a49176d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/Creature.java
ra49176d rb2d7893 354 354 imgProj = LostHavenRPG.imgBow; 355 355 } else if (wType == ItemType.Spell) { 356 imgProj[0] = ImageIO.read(cr.getClass().getResource(" ../images/" + cr.type.toString() + "/proj.png"));357 imgProj[1] = ImageIO.read(cr.getClass().getResource(" ../images/" + cr.type.toString() + "/proj.png"));358 imgProj[2] = ImageIO.read(cr.getClass().getResource(" ../images/" + cr.type.toString() + "/proj.png"));359 imgProj[3] = ImageIO.read(cr.getClass().getResource(" ../images/" + cr.type.toString() + "/proj.png"));360 imgProj[4] = ImageIO.read(cr.getClass().getResource(" ../images/" + cr.type.toString() + "/proj.png"));361 imgProj[5] = ImageIO.read(cr.getClass().getResource(" ../images/" + cr.type.toString() + "/proj.png"));362 imgProj[6] = ImageIO.read(cr.getClass().getResource(" ../images/" + cr.type.toString() + "/proj.png"));363 imgProj[7] = ImageIO.read(cr.getClass().getResource(" ../images/" + cr.type.toString() + "/proj.png"));356 imgProj[0] = ImageIO.read(cr.getClass().getResource("/images/" + cr.type.toString() + "/proj.png")); 357 imgProj[1] = ImageIO.read(cr.getClass().getResource("/images/" + cr.type.toString() + "/proj.png")); 358 imgProj[2] = ImageIO.read(cr.getClass().getResource("/images/" + cr.type.toString() + "/proj.png")); 359 imgProj[3] = ImageIO.read(cr.getClass().getResource("/images/" + cr.type.toString() + "/proj.png")); 360 imgProj[4] = ImageIO.read(cr.getClass().getResource("/images/" + cr.type.toString() + "/proj.png")); 361 imgProj[5] = ImageIO.read(cr.getClass().getResource("/images/" + cr.type.toString() + "/proj.png")); 362 imgProj[6] = ImageIO.read(cr.getClass().getResource("/images/" + cr.type.toString() + "/proj.png")); 363 imgProj[7] = ImageIO.read(cr.getClass().getResource("/images/" + cr.type.toString() + "/proj.png")); 364 364 } 365 365 cr.model = cr.loadModel(cr.type.toString()); … … 391 391 BufferedImage walkE = null; 392 392 BufferedImage walkW = null; 393 boolean hasDeathAnim = (getClass().getResource(" ../images/" + folder + "/Death1.png") != null);393 boolean hasDeathAnim = (getClass().getResource("/images/" + folder + "/Death1.png") != null); 394 394 try { 395 if (getClass().getResource(" ../images/" + folder + "/WalkN.png") != null) {396 walkN = ImageIO.read(getClass().getResource(" ../images/" + folder + "/WalkN.png"));395 if (getClass().getResource("/images/" + folder + "/WalkN.png") != null) { 396 walkN = ImageIO.read(getClass().getResource("/images/" + folder + "/WalkN.png")); 397 397 anmWalkN.addFrame(walkN); 398 walkS = ImageIO.read(getClass().getResource(" ../images/" + folder + "/WalkS.png"));398 walkS = ImageIO.read(getClass().getResource("/images/" + folder + "/WalkS.png")); 399 399 anmWalkS.addFrame(walkS); 400 walkE = ImageIO.read(getClass().getResource(" ../images/" + folder + "/WalkE.png"));400 walkE = ImageIO.read(getClass().getResource("/images/" + folder + "/WalkE.png")); 401 401 anmWalkE.addFrame(walkE); 402 walkW = ImageIO.read(getClass().getResource(" ../images/" + folder + "/WalkW.png"));402 walkW = ImageIO.read(getClass().getResource("/images/" + folder + "/WalkW.png")); 403 403 anmWalkW.addFrame(walkW); 404 } else if (getClass().getResource(" ../images/" + folder + "/WalkN1.png") != null) {405 walkN = ImageIO.read(getClass().getResource(" ../images/" + folder + "/WalkN1.png"));404 } else if (getClass().getResource("/images/" + folder + "/WalkN1.png") != null) { 405 walkN = ImageIO.read(getClass().getResource("/images/" + folder + "/WalkN1.png")); 406 406 anmWalkN.addFrame(walkN); 407 anmWalkN.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/WalkN2.png")));408 walkS = ImageIO.read(getClass().getResource(" ../images/" + folder + "/WalkS1.png"));407 anmWalkN.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/WalkN2.png"))); 408 walkS = ImageIO.read(getClass().getResource("/images/" + folder + "/WalkS1.png")); 409 409 anmWalkS.addFrame(walkS); 410 anmWalkS.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/WalkS2.png")));411 walkE = ImageIO.read(getClass().getResource(" ../images/" + folder + "/WalkE1.png"));410 anmWalkS.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/WalkS2.png"))); 411 walkE = ImageIO.read(getClass().getResource("/images/" + folder + "/WalkE1.png")); 412 412 anmWalkE.addFrame(walkE); 413 anmWalkE.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/WalkE2.png")));414 walkW = ImageIO.read(getClass().getResource(" ../images/" + folder + "/WalkW1.png"));413 anmWalkE.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/WalkE2.png"))); 414 walkW = ImageIO.read(getClass().getResource("/images/" + folder + "/WalkW1.png")); 415 415 anmWalkW.addFrame(walkW); 416 anmWalkW.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/WalkW2.png")));416 anmWalkW.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/WalkW2.png"))); 417 417 } else { 418 418 noAnims = true; 419 anmStandN.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/" + folder + ".png")));420 anmStandS.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/" + folder + ".png")));421 anmStandE.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/" + folder + ".png")));422 anmStandW.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/" + folder + ".png")));423 anmWalkN.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/" + folder + ".png")));424 anmWalkN.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/" + folder + ".png")));425 anmWalkS.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/" + folder + ".png")));426 anmWalkS.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/" + folder + ".png")));427 anmWalkE.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/" + folder + ".png")));428 anmWalkE.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/" + folder + ".png")));429 anmWalkW.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/" + folder + ".png")));430 anmWalkW.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/" + folder + ".png")));431 anmAttackN.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/" + folder + ".png")));432 anmAttackS.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/" + folder + ".png")));433 anmAttackE.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/" + folder + ".png")));434 anmAttackW.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/" + folder + ".png")));419 anmStandN.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/" + folder + ".png"))); 420 anmStandS.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/" + folder + ".png"))); 421 anmStandE.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/" + folder + ".png"))); 422 anmStandW.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/" + folder + ".png"))); 423 anmWalkN.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/" + folder + ".png"))); 424 anmWalkN.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/" + folder + ".png"))); 425 anmWalkS.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/" + folder + ".png"))); 426 anmWalkS.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/" + folder + ".png"))); 427 anmWalkE.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/" + folder + ".png"))); 428 anmWalkE.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/" + folder + ".png"))); 429 anmWalkW.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/" + folder + ".png"))); 430 anmWalkW.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/" + folder + ".png"))); 431 anmAttackN.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/" + folder + ".png"))); 432 anmAttackS.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/" + folder + ".png"))); 433 anmAttackE.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/" + folder + ".png"))); 434 anmAttackW.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/" + folder + ".png"))); 435 435 } 436 436 if (!noAnims) { 437 437 BufferedImage standN, standS, standE, standW; 438 if (getClass().getResource(" ../images/" + folder + "/StandN.png") == null) {438 if (getClass().getResource("/images/" + folder + "/StandN.png") == null) { 439 439 standN = walkN; 440 440 standS = walkS; … … 442 442 standW = walkW; 443 443 } else { 444 standN = ImageIO.read(getClass().getResource(" ../images/" + folder + "/StandN.png"));445 standS = ImageIO.read(getClass().getResource(" ../images/" + folder + "/StandS.png"));446 standE = ImageIO.read(getClass().getResource(" ../images/" + folder + "/StandE.png"));447 standW = ImageIO.read(getClass().getResource(" ../images/" + folder + "/StandW.png"));444 standN = ImageIO.read(getClass().getResource("/images/" + folder + "/StandN.png")); 445 standS = ImageIO.read(getClass().getResource("/images/" + folder + "/StandS.png")); 446 standE = ImageIO.read(getClass().getResource("/images/" + folder + "/StandE.png")); 447 standW = ImageIO.read(getClass().getResource("/images/" + folder + "/StandW.png")); 448 448 anmWalkN = new Animation("north", 0, 0, 40, 60, 150, true); 449 449 anmWalkS = new Animation("south", 0, 0, 40, 60, 150, true); … … 452 452 anmWalkN.addFrame(walkN); 453 453 anmWalkN.addFrame(standN); 454 anmWalkN.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/WalkN2.png")));454 anmWalkN.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/WalkN2.png"))); 455 455 anmWalkN.addFrame(standN); 456 456 anmWalkS.addFrame(walkS); 457 457 anmWalkS.addFrame(standS); 458 anmWalkS.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/WalkS2.png")));458 anmWalkS.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/WalkS2.png"))); 459 459 anmWalkS.addFrame(standS); 460 460 anmWalkE.addFrame(walkE); 461 461 anmWalkE.addFrame(standE); 462 anmWalkE.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/WalkE2.png")));462 anmWalkE.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/WalkE2.png"))); 463 463 anmWalkE.addFrame(standE); 464 464 anmWalkW.addFrame(walkW); 465 465 anmWalkW.addFrame(standW); 466 anmWalkW.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/WalkW2.png")));466 anmWalkW.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/WalkW2.png"))); 467 467 anmWalkW.addFrame(standW); 468 468 } … … 471 471 anmStandE.addFrame(standE); 472 472 anmStandW.addFrame(standW); 473 if (getClass().getResource(" ../images/" + folder + "/AttackN.png") != null) {474 anmAttackN.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/AttackN.png")));473 if (getClass().getResource("/images/" + folder + "/AttackN.png") != null) { 474 anmAttackN.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/AttackN.png"))); 475 475 anmAttackN.addFrame(standN); 476 anmAttackS.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/AttackS.png")));476 anmAttackS.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/AttackS.png"))); 477 477 anmAttackS.addFrame(standS); 478 anmAttackE.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/AttackE.png")));478 anmAttackE.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/AttackE.png"))); 479 479 anmAttackE.addFrame(standE); 480 anmAttackW.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/AttackW.png")));480 anmAttackW.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/AttackW.png"))); 481 481 anmAttackW.addFrame(standW); 482 } else if (getClass().getResource(" ../images/" + folder + "/AttackN1.png") != null) {483 anmAttackN.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/AttackN1.png")));484 anmAttackN.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/AttackN2.png")));485 anmAttackS.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/AttackS1.png")));486 anmAttackS.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/AttackS2.png")));487 anmAttackE.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/AttackE1.png")));488 anmAttackE.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/AttackE2.png")));489 anmAttackW.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/AttackW1.png")));490 anmAttackW.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/AttackW2.png")));482 } else if (getClass().getResource("/images/" + folder + "/AttackN1.png") != null) { 483 anmAttackN.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/AttackN1.png"))); 484 anmAttackN.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/AttackN2.png"))); 485 anmAttackS.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/AttackS1.png"))); 486 anmAttackS.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/AttackS2.png"))); 487 anmAttackE.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/AttackE1.png"))); 488 anmAttackE.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/AttackE2.png"))); 489 anmAttackW.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/AttackW1.png"))); 490 anmAttackW.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/AttackW2.png"))); 491 491 } else { 492 492 anmAttackN.addFrame(standN); … … 496 496 } 497 497 if (hasDeathAnim) { 498 anmDeath.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/Death1.png")));499 anmDeath.addFrame(ImageIO.read(getClass().getResource(" ../images/" + folder + "/Death2.png")));498 anmDeath.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/Death1.png"))); 499 anmDeath.addFrame(ImageIO.read(getClass().getResource("/images/" + folder + "/Death2.png"))); 500 500 } 501 501 }
Note:
See TracChangeset
for help on using the changeset viewer.