Example #1
0
 public override StateChange revealType(int pauseTime)
 {
     if (!isTypeRevealed)
     {
         EnemySoundManager.requestSound(EnemySoundManager.SoundType.FRANKENSTIEN_INTRO);
         base.revealType(pauseTime);
         storedStateChangeObject.setToDefualts();
         clobber(currentRow, currentCollumn - 1, pauseTime);
         clobber(currentRow, currentCollumn + 1, pauseTime);
         storedStateChangeObject.changInBatteryCharge = -0.5f;
     }
     return(storedStateChangeObject);
 }
Example #2
0
 public override StateChange revealType(int pauseTime)
 {
     base.revealType(pauseTime);
     if (hostSet != null)
     {
         EnemySoundManager.requestSound(EnemySoundManager.SoundType.ZOMBIE_INTRO);
         infect(currentRow, currentCollumn + 2, 3);
         infect(currentRow, currentCollumn + 1, 3);
         infect(currentRow, currentCollumn - 1, 3);
         infect(currentRow, currentCollumn - 2, 3);
     }
     return(null);
 }
Example #3
0
 public override StateChange revealType(int pauseTime)
 {
     EnemySoundManager.requestSound(EnemySoundManager.SoundType.DRACULA_INTRO);
     storedStateChangeObject.setToDefualts();
     base.revealType(pauseTime);
     setByteTarget();
     if (pauseTime == 0)
     {
         BiteTarget(byteTarget);
     }
     byteTime = pauseTime;
     bytePos  = 0;
     storedStateChangeObject.puaseForAnimation = true;
     return(storedStateChangeObject);
 }
Example #4
0
 /// <summary>
 ///  Will load images and other recourses required for the game
 /// </summary>
 /// <param name="resources"></param>
 /// <remarks>Note this function is called automatically once the game has started. and should not b called manualy</remarks>
 public static void preLoadResources(ResourceLibrary resources)
 {
     Life.preLoadResources(resources);
     BaseEnemy.preLoadResources(resources);
     Frankenstein.preLoadResources(resources);
     Cat.preLoadResources(resources);
     Ghost.preLoadResources(resources);
     Player.preLoadResources(resources);
     LightBeam.preLoadResources(resources);
     Mummy.preLoadResources(resources);
     Pumpkin.preLoadResources(resources);
     Spider.preLoadResources(resources);
     Vampire.preLoadResources(resources);
     Zombie.preLoadResources(resources);
     LightButton.preLoadResources(resources);
     EnemySoundManager.preLoadResources(resources);
 }
Example #5
0
 /**
  * Will Bite a Random Enemy on the current Row
  * @return the Score Decrement as a result of the Bite
  */
 private void BiteTarget(BaseEnemy target)
 {
     if (hostSet != null && target != null)
     {
         EnemySoundManager.requestSound(EnemySoundManager.SoundType.DRACKULA_ATTACK);
         //Target is Ghost
         //Making Angry
         if (target.type == InteractableObject.ObjectType.GHOST)
         {
             //if not revealed
             if (!target.isTypeRevealed)
             {
                 target.revealType(0);
             }
             ((Ghost)target).MakeAngry();
         }
         //Target is already an angry Ghost
         else if (target.type == InteractableObject.ObjectType.ANGRY)
         {
             //if not revealed
             if (!target.isTypeRevealed)
             {
                 target.revealType(0);
             }
             ((Ghost)target).explode();
             removeThis();
         }
         //Target is not an Angry Ghost
         //Removing Target and Making it an angry Ghost
         else if (target != this && target.type != InteractableObject.ObjectType.CAT)
         {
             target.removeThis();
             Ghost angryGhost = new Ghost(BaseCode.activeLibrary);
             angryGhost.revealType(0);
             hostSet.addEnemy(angryGhost, currentRow, targetEnemyCollumn);
             angryGhost.setCenter(base.getCenterX(), base.getCenterY());
             angryGhost.setAnimationTarget(currentRow, targetEnemyCollumn);
         }
     }
     if (currentTarget != null)
     {
         currentTarget.removeNode();
         currentTarget = null;
     }
     targetEnemyCollumn = -1;
 }
Example #6
0
 public override StateChange revealType(int pauseTime)
 {
     if (!isTypeRevealed)
     {
         EnemySoundManager.requestSound(EnemySoundManager.SoundType.MUMMY_INTRO);
         base.revealType(pauseTime);
         if (hostSet != null)
         {
             for (int loop = 0; loop < hostSet.getNumberOfCollumns(currentRow); loop++)
             {
                 BaseEnemy target = hostSet.getEnemyAt(currentRow, loop);
                 if (target != null && target != this)
                 {
                     target.unrevealType();
                 }
             }
         }
     }
     return(storedStateChangeObject);
 }
Example #7
0
 private void ByteTarget(BaseEnemy target)
 {
     if (target != null && hostSet != null)
     {
         EnemySoundManager.requestSound(EnemySoundManager.SoundType.CAT_ATTACK);
         if (target.type == InteractableObject.ObjectType.ANGRY)
         {
             ((Ghost)target).explode();
             removeThis();
         }
         else
         {
             target.removeThis();
         }
     }
     if (currentTarget != null)
     {
         currentTarget.removeNode();
         currentTarget = null;
     }
     targetEnemyCollumn = -1;
 }
Example #8
0
        /**
         * Will Make the Ghost Explode and return the changes to the player state
         * @return any changes to player state as a result of the explotion
         */
        public StateChange explode()
        {
            EnemySoundManager.requestSound(EnemySoundManager.SoundType.GHOST_EXPLODE);
            if (!isTypeRevealed)
            {
                revealType(0);
            }
            if (!angry)
            {
                MakeAngry();
            }
            base.setSprite(explodeSprite);
            explodeTimer.visible = false;
            angryTimer           = (explodeSprite.getTotalFrames() * 2);
            explodeTimer.setFilledSegments(0);
            killEnemy(currentRow - 1, currentCollumn + 1);
            killEnemy(currentRow - 1, currentCollumn - 1);
            killEnemy(currentRow - 1, currentCollumn);
            killEnemy(currentRow + 1, currentCollumn + 1);
            killEnemy(currentRow + 1, currentCollumn - 1);
            killEnemy(currentRow + 1, currentCollumn);
            killEnemy(currentRow, currentCollumn + 1);
            killEnemy(currentRow, currentCollumn - 1);

            if (hostSet != null)
            {
                base.setWidth(hostSet.getCollumnSpacing() * 3);
                base.setHeight(hostSet.getRowSpacing() * 3);
                hostSet.moveEnemytoSubSet(this);
            }
            else
            {
                base.setSize(base.getWidth() * 5, base.getHeight() * 5);
            }
            vibrate = false;
            return(getExplodeEffects());
        }
Example #9
0
        /**
         * Updates when state = EndState.CONTINUE;
         */
        protected void updateContinue()
        {
            typeSelectedText.text = ("Score: " + player.getScore());

            EnemySoundManager.update();

            //updating turn
            if (this.updateTurn)
            {
                changeState(enemies.updateTurn());
                updateTurn = false;
            }
            player.update();
            player.selectTargetableEnemies();
            //No Animation currently playing user receives update
            if (animationPuaseTimer <= 0)
            {
                if (currentLevel != null)
                {
                    currentLevel.objectGrid.setObjectGrid(enemies.getGrid());
                    synkPlayerStateWithTrueState();
                    currentLevel.update();
                    synkTrueStateWithPlayerState();
                    StateChange change = enemies.synkGrid(currentLevel.objectGrid.getObjectGrid(), animationDelay);
                    changeState(change);
                    if (change != null && change.puaseForAnimation)
                    {
                        animationPuaseTimer = animationDelay;
                        enemies.setEnemyAnimations(0);
                    }
                }
                if (state == GameState.EndState.LOSE)
                {
                    if (currentLevel != null)
                    {
                        currentLevel.end();
                    }
                    gameLose();
                    setUpdateState(updateState.TRANSITION);
                }
                else if (state == GameState.EndState.WIN)
                {
                    if (currentLevel != null)
                    {
                        currentLevel.end();
                    }
                    gameWin();
                    setUpdateState(updateState.TRANSITION);
                }
            }
            //Animation is playing user does not receive update
            else
            {
                animationPuaseTimer--;
            }
            //Esc Menue
            if (BaseCode.activeKeyboard.isKeyDown(Keys.Escape) && active != updateState.ESC)
            {
                setUpdateState(updateState.ESC);
            }
            //Close
            if (BaseCode.activeKeyboard.isKeyDown(Keys.F5))
            {
                base.closeWindow();
                return;
            }
        }
Example #10
0
        /**
         * Will change the update state to the given update state
         * This will Determine what objects receive updates and which objects are visible
         * @param newState
         */
        internal void setUpdateState(updateState newState)
        {
            if (active != newState)
            {
                //In Game
                if (newState == updateState.INGAME)
                {
                    player.visible = true;
                    player.getLight().visible = true;
                    powerBar.setVisibility(true);
                    laserButton.setVisibility(true, true);
                    wideButton.setVisibility(true, true);
                    mediumButton.setVisibility(true, true);
                    userText.visible         = true;
                    typeSelectedText.visible = true;

                    mainMenue.setState(MenueSystem.Panel.PanelState.INACTIVE, true);
                    mainMenue.setVisibility(false, true);
                    escapeMenue.setState(MenueSystem.Panel.PanelState.INACTIVE, true);
                    escapeMenue.setVisibility(false, true);
                    transitionMenue.setState(MenueSystem.Panel.PanelState.INACTIVE, true);
                    transitionMenue.setVisibility(false, true);
                    active = newState;
                }
                //Main Menue
                else if (newState == updateState.MAINMENUE)
                {
                    player.visible = false;
                    player.getLight().visible = false;
                    powerBar.setVisibility(false);
                    laserButton.setVisibility(false, true);
                    wideButton.setVisibility(false, true);
                    mediumButton.setVisibility(false, true);
                    userText.visible         = false;
                    typeSelectedText.visible = false;
                    enemies.RemoveAllEnemies();
                    mediumButton.setSparcleVisiblity(false);
                    wideButton.setSparcleVisiblity(false);
                    laserButton.setSparcleVisiblity(false);
                    if (currentLevel != null)
                    {
                        currentLevel.end();
                    }
                    EnemySoundManager.clear();

                    mainMenue.setVisibility(true, true);
                    mainMenue.setState(MenueSystem.Panel.PanelState.IDLE, true);

                    escapeMenue.setState(MenueSystem.Panel.PanelState.INACTIVE, true);
                    escapeMenue.setVisibility(false, true);
                    transitionMenue.setState(MenueSystem.Panel.PanelState.INACTIVE, true);
                    transitionMenue.setVisibility(false, true);
                    active = newState;
                    setHeartCount(0);
                }
                //Transition Menue
                else if (newState == updateState.TRANSITION)
                {
                    if (state == GameState.EndState.LOSE || state == GameState.EndState.WIN)
                    {
                        transitionMenue.setVisibility(true, true);
                        transitionMenue.setState(MenueSystem.Panel.PanelState.IDLE, true);

                        mainMenue.setState(MenueSystem.Panel.PanelState.INACTIVE, true);
                        mainMenue.setVisibility(false, true);
                        escapeMenue.setState(MenueSystem.Panel.PanelState.INACTIVE, true);
                        escapeMenue.setVisibility(false, true);
                        active = newState;

                        if (state == GameState.EndState.LOSE)
                        {
                            transitionMenue.getPanel(1).setState(MenueSystem.Panel.PanelState.INACTIVE, true);
                            ((MenueSystem.Label)transitionMenue.getPanel(2)).setText(((LevelButton)mainMenue.getPanel(2).getPanel(0).getPanel(LevelNumber)).loseMessage);
                        }
                        else
                        {
                            if (((LevelButton)transitionMenue.getPanel(1)).gameLevel != null)
                            {
                                transitionMenue.getPanel(1).setState(MenueSystem.Panel.PanelState.IDLE, true);
                            }
                            else
                            {
                                transitionMenue.getPanel(1).setState(MenueSystem.Panel.PanelState.INACTIVE, true);
                            }
                            ((MenueSystem.Label)transitionMenue.getPanel(2)).setText(((LevelButton)mainMenue.getPanel(2).getPanel(0).getPanel(LevelNumber)).winMessage);
                        }
                    }
                    else
                    {
                        setUpdateState(updateState.ESC);
                    }
                }
                //Escape Menu
                else if (newState == updateState.ESC)
                {
                    escapeMenue.setVisibility(true, true);
                    escapeMenue.setState(MenueSystem.Panel.PanelState.IDLE, true);

                    mainMenue.setState(MenueSystem.Panel.PanelState.INACTIVE, true);
                    mainMenue.setVisibility(false, true);
                    transitionMenue.setState(MenueSystem.Panel.PanelState.INACTIVE, true);
                    transitionMenue.setVisibility(false, true);
                    active = newState;
                }
            }
        }
Example #11
0
 public override StateChange revealType(int pauseTime)
 {
     EnemySoundManager.requestSound(EnemySoundManager.SoundType.GHOST_INTRO);
     explodeTimer.visible = true;
     return(base.revealType(pauseTime));
 }