//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()); }
/** * 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()); }
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(); }