MCPcopy Create free account
hub / github.com/catabriga/graphwar / drawExplosion

Method drawExplosion

src/Graphwar/GraphPlane.java:382–437  ·  view source on GitHub ↗
(Graphics g, boolean terrainReversed)

Source from the content-addressed store, hash-verified

380
381
382 private void drawExplosion(Graphics g, boolean terrainReversed)
383 {
384 if(graphwar.getGameData().isExploding())
385 {
386 repaintBack = true;
387
388 long timePassedExploding = graphwar.getGameData().getTimeExploding();
389
390 Function function = graphwar.getGameData().getFunction();
391
392 int width = explosionImages[0].getWidth(null);
393 int height = explosionImages[0].getHeight(null);
394
395 int drawX = (int) (function.getLastX());
396 int drawY = (int) (function.getLastY() - height/2);
397
398 boolean funcReversed = graphwar.getGameData().isFunctionReversed();
399 if((funcReversed || terrainReversed) && !(funcReversed && terrainReversed))
400 {
401 drawX = Constants.PLANE_LENGTH-drawX;
402 }
403
404 drawX = drawX - width/2;
405
406 /*
407 Image back = graphwar.getGameData().getObstacle().getImage();
408
409 int x = drawX;
410 if((funcReversed || terrainReversed) && !(funcReversed && terrainReversed))
411 {
412 x = Constants.PLANE_LENGTH - x;
413 }
414
415 g.drawImage( back,
416 drawX, drawY,
417 drawX+width, drawY+height,
418 x, drawY,
419 x+width, drawY+height,
420 null);
421 */
422
423 for(int i=0; i<explosionDurations.length; i++)
424 {
425 if(timePassedExploding > explosionDurations[i])
426 {
427 timePassedExploding -= explosionDurations[i];
428 }
429 else
430 {
431 g.drawImage(explosionImages[i], drawX, drawY, null);
432
433 return;
434 }
435 }
436 }
437 }
438
439 private Image getSoldierImage(Soldier soldier, int player)

Callers 1

paintComponentMethod · 0.95

Calls 7

getLastXMethod · 0.95
getLastYMethod · 0.95
getGameDataMethod · 0.80
isFunctionReversedMethod · 0.80
isExplodingMethod · 0.45
getTimeExplodingMethod · 0.45
getFunctionMethod · 0.45

Tested by

no test coverage detected