//Defialt Constructor //Sets image to new public Ghost(ResourceLibrary library) : base(library) { explodeSprite = (Sprite)library.getResource("GhostLight/GhostLight/resources/explode/explode1.png"); angrySprite = (Sprite)library.getResource("GhostLight/GhostLight/resources/angry-ghost1.png"); complacentSprite = (Sprite)library.getResource("GhostLight/GhostLight/resources/ghost1.png"); type = InteractableObject.ObjectType.GHOST; MakeNotAngry(); unrevealType(); health.setMaxSegments(InteractableObject.getDefualthealth(type)); health.setFilledSegments(health.getMaxSegments()); score = InteractableObject.getDefualtScore(type); base.setInvulnerablility(InteractableObject.getDefualtInvulnerability(type)); health.setHeight(0.35f); explodeTimer.setHeight(0.7f); explodeTimer.visible = false; explodeTimer.setCenterX(base.getCenterX()); explodeTimer.setCenterY(health.getCenterY() - (base.getHeight() / 2) + 0.35f); explodeTimer.setWidth(base.getWidth()); explodeTimer.setColor(Color.Yellow); explodeTimer.setMaxSegments(angrySprite.getTotalFrames() + complacentSprite.getTotalFrames()); explodeTimer.setFilledSegments(explodeTimer.getMaxSegments()); }
private void updateHealth() { if (health != null) { health.setCenterX(base.getCenterX()); health.setCenterY(base.getCenterY() + (base.getHeight() / 2)); health.setSize(base.getWidth(), 0.7f); } }
/** * decrements infectedTimer and updates infectBar */ private void updateInfectedStatus() { //infect Bar infectBar.setWidth(base.getWidth()); infectBar.setHeight(health.getHeight()); infectBar.setCenterX(base.getCenterX()); infectBar.setCenterY(health.getCenterY() - health.getHeight()); //infectCloud infectCloud.setSize(base.getWidth(), base.getHeight()); infectCloud.setCenter(base.getCenterX(), base.getCenterY()); }