/** * Will set the Infect Status to the Given int * Giving a -1 will make this Enemy Permanently Infected */ public void setInfectStatus(int newInfectStatus) { infectedTimer = newInfectStatus; if (infectedTimer > 0) { infectCloud.visible = true; infectBar.visible = true; if (infectBar.getMaxSegments() < infectedTimer) { infectBar.setMaxSegments(infectedTimer); infectBar.setFilledSegments(infectedTimer); } else { infectBar.setFilledSegments(infectedTimer); } } else { infectCloud.visible = false; infectBar.visible = false; infectBar.setMaxSegments(1); infectedTimer = 0; } }
public BaseEnemy(ResourceLibrary library) : base() { hostSet = null; hostNode = null; base.setCenterY(-5); base.setSize(5f, 5f); base.rectangleVisible = false; base.spriteVisible = true; base.visible = true; unrevealedSprite = (Sprite)BaseCode.activeLibrary.getResource("GhostLight/GhostLight/resources/unrevealed.png"); selected = new DrawRectangle(); selected.visible = false; selected.setSprite((Sprite)BaseCode.activeLibrary.getResource("GhostLight/GhostLight/resources/glow.png")); selected.rectangleVisible = false; updateSelected(); highLight = new DrawRectangle(); highLight.visible = true; highLight.setSprite((Sprite)BaseCode.activeLibrary.getResource("GhostLight/GhostLight/resources/sparcle/sparcle1.png")); highLight.rectangleVisible = false; updateHighLight(); highLight.visible = false; displayedScore = new Text(); displayedScore.targetFont = (LoadableFont)BaseCode.activeLibrary.getResource(LoadableFont.createFontID("Comic Sans MS", 1.5f, FontStyle.Italic)); displayedScore.textColor = Color.White; displayedScore.visible = false; updateDisplayedScore(); health.setMaxSegments(2); health.setMaxSegments(health.getMaxSegments()); health.visible = false; health.setWidth(base.getWidth()); health.setHeight(1.4f); health.setColor(Color.LightGreen); infectBar.setColor(Color.FromArgb(10, 80, 40)); infectBar.visible = false; infectCloud = new DrawRectangle(); infectCloud.setSprite((Sprite)library.getResource("GhostLight/GhostLight/resources/infected.png")); infectCloud.rectangleVisible = false; infectCloud.visible = false; base.setPriority(2); updateImage(); }
//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()); }