public void continueTransition(GameInit gameInit)
        {
            if (fadeOut)
            {
                fadeCounter++;

                if (fadeCounter == FADE_THRESHOLD)
                {
                    fadeOut = false;
                    transition(gameInit);
                }

                fadeColor = fadeColors[fadeCounter];
            }
            else
            {
                fadeCounter--;

                if (fadeCounter == 0)
                {
                    transitioning = false;
                }

                fadeColor = fadeColors[fadeCounter];
            }
        }
Exemple #2
0
        public bool checkActions(GameInit gameInit, KeyHandler keyHandler, ContentHandler content)
        {
            if (keyHandler.isActionReady())
            {
                if (checkMainAction(gameInit, keyHandler))
                {
                    return true;
                }
            }

            if (keyHandler.isBackReady())
            {
                return true;
            }

            if (keyHandler.isM1Ready())
            {
                return true;
            }

            if (keyHandler.isM2Ready())
            {
                return true;
            }
            return false;
        }
Exemple #3
0
        public void continueActivation(GameInit gameInit)
        {
            finishedObjects.Clear();
            for (int i = 0; i < activatingObjects.Count; i++)
            {
                ManipulatableObject currentObject = activatingObjects[i];
                Character currentCharacter = interactingCharacters[i];

                if (currentObject.isFinishedActivating())
                {
                    activatingObjects.RemoveAt(i);
                    interactingCharacters.RemoveAt(i);
                    finishedObjects.Add(currentObject);
                    i--;
                }
                else
                {
                    currentObject.continueActivation(gameInit, currentCharacter);
                }

                if (activatingObjects.Count == 0 || i == activatingObjects.Count - 1)
                {
                    break;
                }
            }

            finishActivation(gameInit);
        }
 public void createRegion(GameInit gameInit, ContentHandler content, int regionNumber, int zoneNumber)
 {
     gameInit.getFreeRoamState().setCurrentRegion(regionNumber);
     gameInit.getRegionFactory().getZoneFactories()[regionNumber].createZones();
     gameInit.getFreeRoamState().setCurrentZones(gameInit.getRegionFactory().getZoneFactories()[regionNumber].getRegionZones());
     gameInit.getFreeRoamState().setCurrentZone(zoneNumber);
     content.getRegionContent()[regionNumber].loadContent();
 }
        // should find some file and load from it
        public void loadGame(GameInit gameInit, ContentHandler content, TransitionHandler transitionHandler)
        {
            transitionHandler.createRegion(gameInit, content, 0, 0);

            gameInit.getParty().addPartyMember(gameInit.getCharacterFactory().createCharacter(0, 0));

            gameInit.getParty().getPartyMembers()[0].setXPosition(50);
            gameInit.getParty().getPartyMembers()[0].setYPosition(50);
            gameInit.getParty().getPartyMembers()[0].setHeight(2);
            gameInit.getParty().getPartyMembers()[0].setFacingDirection(0);
            gameInit.getFreeRoamState().getCurrentZone().addCharacter(gameInit.getParty().getPartyMembers()[0], 50, 50);
            gameInit.getMessageBlockFactory().createRegionCharacterBlocks(0);
            gameInit.getGameState().setFreeRoamState();
        }
Exemple #6
0
 public void updateLogic(GameInit gameInit, KeyHandler keyHandler, ContentHandler content)
 {
     if (gameInit.getGameState().getState() == gameInit.getGameState().START_STATE)
     {
         updateStartLogic(gameInit, keyHandler, content);
     }
     else if (gameInit.getGameState().getState() == gameInit.getGameState().FREE_ROAM_STATE)
     {
         updateFreeRoamLogic(gameInit, keyHandler, content);
     }
     else if (gameInit.getGameState().getState() == gameInit.getGameState().BATTLE_STATE)
     {
         updateBattleLogic(gameInit, keyHandler, content);
     }
     else if (gameInit.getGameState().getState() == gameInit.getGameState().PAUSE_STATE)
     {
     }
 }
Exemple #7
0
 public void draw(SpriteBatch spriteBatch, GameInit gameInit, ContentHandler contentHandler, Color color)
 {
     if (gameInit.getGameState().getState() == gameInit.getGameState().START_STATE)
     {
         drawStartState(spriteBatch, gameInit, contentHandler, color);
     }
     else if (gameInit.getGameState().getState() == gameInit.getGameState().FREE_ROAM_STATE)
     {
         drawFreeRoamState(spriteBatch, gameInit, contentHandler, color);
     }
     else if (gameInit.getGameState().getState() == gameInit.getGameState().BATTLE_STATE)
     {
         drawBattleState(spriteBatch, gameInit, contentHandler, color);
     }
     else if (gameInit.getGameState().getState() == gameInit.getGameState().PAUSE_STATE)
     {
         drawPauseState(spriteBatch, gameInit, contentHandler, color);
     }
 }
Exemple #8
0
 //pass in some save data as well
 public void loadGame(GameInit gameInit, ContentHandler content)
 {
     saveGameHandler.loadGame(gameInit, content, transitionHandler);
 }
Exemple #9
0
 private bool checkMove(GameInit gameInit, KeyHandler keyHandler, ContentHandler content)
 {
     return movementHandler.checkMove(gameInit, keyHandler, content);
 }
Exemple #10
0
 private void updateStartLogic(GameInit gameInit, KeyHandler keyHandler, ContentHandler content)
 {
 }
Exemple #11
0
        private bool checkForInteract(GameInit gameInit, int targetX, int targetY)
        {
            if (gameInit.getFreeRoamState().getCurrentZone().getTrafficMap().getCharacterBooleanMap()[targetX, targetY])
            {
                // talk to character
                Character character = gameInit.getFreeRoamState().getCurrentZone().getTrafficMap().getCharacterMap()[targetX, targetY];

                return true;
            }
            else
            {
                if (gameInit.getFreeRoamState().getCurrentZone().getTrafficMap().getObjectBooleanMap()[targetX, targetY])
                {
                    ManipulatableObject obj = gameInit.getFreeRoamState().getCurrentZone().getTrafficMap().getObjectMap()[targetX, targetY];

                    if (obj.checkForInteract(gameInit.getParty().getPartyMembers()[0].getFacingDirection()))
                    {
                        obj.activate(gameInit, gameInit.getParty().getPartyMembers()[0], 0);

                        if (obj.showChatWindow())
                        {
                            obj.talk(gameInit);
                            activating = false;
                            chatWindow = true;
                            objectChat = true;
                            chatObject = obj;
                            chatCounter = 0;
                        }
                        else
                        {
                            activatingObjects.Add(obj);
                            interactingCharacters.Add(gameInit.getParty().getPartyMembers()[0]);
                            activating = true;
                        }
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
                else
                {
                    return false;
                }
            }
        }
Exemple #12
0
        public void continueChatWindow(GameInit gameInit, KeyHandler keyHandler)
        {
            chatCounter++;

            if (chatCounter > CHAT_THRESHOLD)
            {
                if (keyHandler.isActionReady())
                {
                    chatObject.advanceMessage(gameInit);

                    if (!chatObject.showChatWindow())
                    {
                        chatWindow = false;
                        gameInit.getFreeRoamState().setChatWindow(false);
                    }
                    else
                    {
                        chatObject.talk(gameInit);
                    }

                    if (chatObject.giveItem())
                    {
                        chatObject.noItem();
                    }
                }
                else if (keyHandler.isBackReady())
                {
                    chatObject.backAdvanceMessage(gameInit);

                    if (!chatObject.showChatWindow())
                    {
                        chatWindow = false;
                        gameInit.getFreeRoamState().setChatWindow(false);
                    }
                    else
                    {
                        chatObject.talk(gameInit);
                    }

                    if (chatObject.giveItem())
                    {
                        chatObject.noItem();
                    }
                }
                else if (keyHandler.getUpTime() >= keyHandler.getDownTime())
                {
                    if (keyHandler.getUpTime() >= 3)
                    {
                        chatObject.moveUpOptionIndex(gameInit);
                    }
                }
                else if (keyHandler.getDownTime() >= 3)
                {
                    chatObject.moveDownOptionIndex(gameInit);
                }
            }
            else
            {
                if (keyHandler.getUpTime() >= keyHandler.getDownTime())
                {
                    if (keyHandler.getUpTime() >= 3)
                    {
                        chatObject.moveUpOptionIndex(gameInit);
                    }
                }
                else if (keyHandler.getDownTime() >= 3)
                {
                    chatObject.moveDownOptionIndex(gameInit);
                }
            }
        }
        public void updateMove(GameInit gameInit)
        {
            movementIndex++;
            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().advanceAnimation();
            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);

            if (movementIndex == switchThreshold)
            {
                int direction = gameInit.getParty().getPartyMembers()[0].getFacingDirection();

                if (direction == 0)
                {
                    gameInit.getParty().getPartyMembers()[0].moveUp();
                    int x = gameInit.getParty().getPartyMembers()[0].getX();
                    int y = gameInit.getParty().getPartyMembers()[0].getY();
                    gameInit.getParty().getPartyMembers()[0].setHeight(gameInit.getFreeRoamState().getCurrentZone().getTileMap()[x, y].getWalkingHeight());

                }
                else if (direction == 1)
                {
                    gameInit.getParty().getPartyMembers()[0].moveDown();
                    int x = gameInit.getParty().getPartyMembers()[0].getX();
                    int y = gameInit.getParty().getPartyMembers()[0].getY();
                    gameInit.getParty().getPartyMembers()[0].setHeight(gameInit.getFreeRoamState().getCurrentZone().getTileMap()[x, y].getWalkingHeight());
                }
                else if (direction == 2)
                {
                    gameInit.getParty().getPartyMembers()[0].moveRight();
                    int x = gameInit.getParty().getPartyMembers()[0].getX();
                    int y = gameInit.getParty().getPartyMembers()[0].getY();
                    gameInit.getParty().getPartyMembers()[0].setHeight(gameInit.getFreeRoamState().getCurrentZone().getTileMap()[x, y].getWalkingHeight());
                }
                else if (direction == 3)
                {
                    gameInit.getParty().getPartyMembers()[0].moveLeft();
                    int x = gameInit.getParty().getPartyMembers()[0].getX();
                    int y = gameInit.getParty().getPartyMembers()[0].getY();
                    gameInit.getParty().getPartyMembers()[0].setHeight(gameInit.getFreeRoamState().getCurrentZone().getTileMap()[x, y].getWalkingHeight());
                }
            }

            if (movementIndex == movementOffsets.Count - 1)
            {
                moving = false;
                int direction = gameInit.getParty().getPartyMembers()[0].getFacingDirection();
                int x = gameInit.getParty().getPartyMembers()[0].getX();
                int y = gameInit.getParty().getPartyMembers()[0].getY();

                if (direction == 0)
                {
                    gameInit.getFreeRoamState().getCurrentZone().clearCharacter(x + 1, y);
                }
                else if (direction == 1)
                {
                    gameInit.getFreeRoamState().getCurrentZone().clearCharacter(x - 1, y);
                }
                else if (direction == 2)
                {
                    gameInit.getFreeRoamState().getCurrentZone().clearCharacter(x, y + 1);
                }
                else if (direction == 3)
                {
                    gameInit.getFreeRoamState().getCurrentZone().clearCharacter(x, y - 1);
                }
            }
        }
        public void movePlayer(GameInit gameInit)
        {
            int direction = gameInit.getParty().getPartyMembers()[0].getFacingDirection();

            if (direction == 0)
            {
                int x = gameInit.getParty().getPartyMembers()[0].getX();
                int y = gameInit.getParty().getPartyMembers()[0].getY();

                Tile currentTile = gameInit.getFreeRoamState().getCurrentZone().getTileMap()[x, y];
                Tile destinationTile = gameInit.getFreeRoamState().getCurrentZone().getTileMap()[x - 1, y];

                int heightDiff = currentTile.getWalkingHeight() - destinationTile.getWalkingHeight();

                gameInit.getFreeRoamState().getCurrentZone().addCharacter(gameInit.getParty().getPartyMembers()[0], x - 1, y);

                if (heightDiff == 0)
                {
                    if (currentTile.isSloped())
                    {
                        if (destinationTile.isSloped())
                        {
                            //SASA
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(4);
                            movementOffsets = tileMovementVectors.getVectors(0, "SASA");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 4;
                        }
                        else
                        {
                            //SUF
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(4);
                            movementOffsets = tileMovementVectors.getVectors(0, "SUF");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 5;
                        }
                    }
                    else
                    {
                        if (destinationTile.isSloped())
                        {
                            //FSD
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(4);
                            movementOffsets = tileMovementVectors.getVectors(0, "FSD");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 5;
                        }
                        else
                        {
                            //FFS
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(4);
                            movementOffsets = tileMovementVectors.getVectors(0, "FFS");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 4;
                        }
                    }
                }
                else if (heightDiff == 1)
                {
                    if (currentTile.isSloped())
                    {
                        if (destinationTile.isSloped())
                        {
                            //SDSD
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(4);
                            movementOffsets = tileMovementVectors.getVectors(0, "SDSD");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 5;
                        }
                        else
                        {
                            //SDF
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(4);
                            movementOffsets = tileMovementVectors.getVectors(0, "SDF");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 5;
                        }
                    }
                    else
                    {
                        //FFL
                        moving = true;
                        movementIndex = 0;
                        gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(4);
                        movementOffsets = tileMovementVectors.getVectors(0, "FFL");
                        gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                        switchThreshold = 5;
                    }
                }
                else if (heightDiff == -1)
                {
                    if (currentTile.isSloped())
                    {
                        //SUSU
                        moving = true;
                        movementIndex = 0;
                        gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(4);
                        movementOffsets = tileMovementVectors.getVectors(0, "SUSU");
                        gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                        switchThreshold = 5;
                    }
                    else
                    {
                        if (destinationTile.isSloped())
                        {
                            //FSU
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(4);
                            movementOffsets = tileMovementVectors.getVectors(0, "FSU");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 5;
                        }
                        else
                        {
                            //FFH
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(4);
                            movementOffsets = tileMovementVectors.getVectors(0, "FFH");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 5;
                        }
                    }
                }
                else
                {
                }

            }
            else if (direction == 1)
            {
                int x = gameInit.getParty().getPartyMembers()[0].getX();
                int y = gameInit.getParty().getPartyMembers()[0].getY();

                Tile currentTile = gameInit.getFreeRoamState().getCurrentZone().getTileMap()[x, y];
                Tile destinationTile = gameInit.getFreeRoamState().getCurrentZone().getTileMap()[x + 1, y];

                int heightDiff = currentTile.getWalkingHeight() - destinationTile.getWalkingHeight();

                gameInit.getFreeRoamState().getCurrentZone().addCharacter(gameInit.getParty().getPartyMembers()[0], x + 1, y);

                if (heightDiff == 0)
                {
                    if (currentTile.isSloped())
                    {
                        if (destinationTile.isSloped())
                        {
                            //SASA
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(5);
                            movementOffsets = tileMovementVectors.getVectors(1, "SASA");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 1;
                        }
                        else
                        {
                            //SUF
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(5);
                            movementOffsets = tileMovementVectors.getVectors(1, "SUF");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 1;
                        }
                    }
                    else
                    {
                        if (destinationTile.isSloped())
                        {
                            //FSD
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(5);
                            movementOffsets = tileMovementVectors.getVectors(1, "FSD");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 1;
                        }
                        else
                        {
                            //FFS
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(5);
                            movementOffsets = tileMovementVectors.getVectors(1, "FFS");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 1;
                        }
                    }
                }
                else if (heightDiff == 1)
                {
                    if (currentTile.isSloped())
                    {
                        if (destinationTile.isSloped())
                        {
                            //SDSD
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(5);
                            movementOffsets = tileMovementVectors.getVectors(1, "SDSD");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 1;
                        }
                        else
                        {
                            //SDF
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(5);
                            movementOffsets = tileMovementVectors.getVectors(1, "SDF");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 1;
                        }
                    }
                    else
                    {
                        //FFL
                        moving = true;
                        movementIndex = 0;
                        gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(5);
                        movementOffsets = tileMovementVectors.getVectors(1, "FFL");
                        gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                        switchThreshold = 1;
                    }
                }
                else if (heightDiff == -1)
                {
                    if (currentTile.isSloped())
                    {
                        //SUSU
                        moving = true;
                        movementIndex = 0;
                        gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(5);
                        movementOffsets = tileMovementVectors.getVectors(1, "SUSU");
                        gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                        switchThreshold = 1;
                    }
                    else
                    {
                        if (destinationTile.isSloped())
                        {
                            //FSU
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(5);
                            movementOffsets = tileMovementVectors.getVectors(1, "FSU");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 1;
                        }
                        else
                        {
                            //FFH
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(5);
                            movementOffsets = tileMovementVectors.getVectors(1, "FFH");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 1;
                        }
                    }
                }
                else
                {
                }

            }
            else if (direction == 2)
            {
                int x = gameInit.getParty().getPartyMembers()[0].getX();
                int y = gameInit.getParty().getPartyMembers()[0].getY();

                Tile currentTile = gameInit.getFreeRoamState().getCurrentZone().getTileMap()[x, y];
                Tile destinationTile = gameInit.getFreeRoamState().getCurrentZone().getTileMap()[x, y - 1];

                int heightDiff = currentTile.getWalkingHeight() - destinationTile.getWalkingHeight();

                gameInit.getFreeRoamState().getCurrentZone().addCharacter(gameInit.getParty().getPartyMembers()[0], x, y - 1);

                if (heightDiff == 0)
                {
                    if (currentTile.isSloped())
                    {
                        if (destinationTile.isSloped())
                        {
                            //SASA
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(6);
                            movementOffsets = tileMovementVectors.getVectors(2, "SASA");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 1;
                        }
                        else
                        {
                            //SUF
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(6);
                            movementOffsets = tileMovementVectors.getVectors(2, "SUF");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 1;
                        }
                    }
                    else
                    {
                        if (destinationTile.isSloped())
                        {
                            //FSD
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(6);
                            movementOffsets = tileMovementVectors.getVectors(2, "FSD");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 1;
                        }
                        else
                        {
                            //FFS
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(6);
                            movementOffsets = tileMovementVectors.getVectors(2, "FFS");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 1;
                        }
                    }
                }
                else if (heightDiff == 1)
                {
                    if (currentTile.isSloped())
                    {
                        if (destinationTile.isSloped())
                        {
                            //SDSD
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(6);
                            movementOffsets = tileMovementVectors.getVectors(2, "SDSD");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 1;
                        }
                        else
                        {
                            //SDF
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(6);
                            movementOffsets = tileMovementVectors.getVectors(2, "SDF");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 1;
                        }
                    }
                    else
                    {
                        //FFL
                        moving = true;
                        movementIndex = 0;
                        gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(6);
                        movementOffsets = tileMovementVectors.getVectors(2, "FFL");
                        gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                        switchThreshold = 1;
                    }
                }
                else if (heightDiff == -1)
                {
                    if (currentTile.isSloped())
                    {
                        //SUSU
                        moving = true;
                        movementIndex = 0;
                        gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(6);
                        movementOffsets = tileMovementVectors.getVectors(2, "SUSU");
                        gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                        switchThreshold = 1;
                    }
                    else
                    {
                        if (destinationTile.isSloped())
                        {
                            //FSU
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(6);
                            movementOffsets = tileMovementVectors.getVectors(2, "FSU");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 1;
                        }
                        else
                        {
                            //FFH
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(6);
                            movementOffsets = tileMovementVectors.getVectors(2, "FFH");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 1;
                        }
                    }
                }
                else
                {
                }
            }
            else if (direction == 3)
            {
                int x = gameInit.getParty().getPartyMembers()[0].getX();
                int y = gameInit.getParty().getPartyMembers()[0].getY();

                Tile currentTile = gameInit.getFreeRoamState().getCurrentZone().getTileMap()[x, y];
                Tile destinationTile = gameInit.getFreeRoamState().getCurrentZone().getTileMap()[x, y + 1];

                int heightDiff = currentTile.getWalkingHeight() - destinationTile.getWalkingHeight();

                gameInit.getFreeRoamState().getCurrentZone().addCharacter(gameInit.getParty().getPartyMembers()[0], x, y + 1);

                if (heightDiff == 0)
                {
                    if (currentTile.isSloped())
                    {
                        if (destinationTile.isSloped())
                        {
                            //SASA
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(7);
                            movementOffsets = tileMovementVectors.getVectors(3, "SASA");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 4;
                        }
                        else
                        {
                            //SUF
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(7);
                            movementOffsets = tileMovementVectors.getVectors(3, "SUF");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 5;
                        }
                    }
                    else
                    {
                        if (destinationTile.isSloped())
                        {
                            //FSD
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(7);
                            movementOffsets = tileMovementVectors.getVectors(3, "FSD");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 5;
                        }
                        else
                        {
                            //FFS
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(7);
                            movementOffsets = tileMovementVectors.getVectors(3, "FFS");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 4;
                        }
                    }
                }
                else if (heightDiff == 1)
                {
                    if (currentTile.isSloped())
                    {
                        if (destinationTile.isSloped())
                        {
                            //SDSD
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(7);
                            movementOffsets = tileMovementVectors.getVectors(3, "SDSD");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 5;
                        }
                        else
                        {
                            //SDF
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(7);
                            movementOffsets = tileMovementVectors.getVectors(3, "SDF");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 5;
                        }
                    }
                    else
                    {
                        //FFL
                        moving = true;
                        movementIndex = 0;
                        gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(7);
                        movementOffsets = tileMovementVectors.getVectors(3, "FFL");
                        gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                        switchThreshold = 5;
                    }
                }
                else if (heightDiff == -1)
                {
                    if (currentTile.isSloped())
                    {
                        //SUSU
                        moving = true;
                        movementIndex = 0;
                        gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(7);
                        movementOffsets = tileMovementVectors.getVectors(3, "SUSU");
                        gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                        switchThreshold = 5;
                    }
                    else
                    {
                        if (destinationTile.isSloped())
                        {
                            //FSU
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(7);
                            movementOffsets = tileMovementVectors.getVectors(3, "FSU");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 5;
                        }
                        else
                        {
                            //FFH
                            moving = true;
                            movementIndex = 0;
                            gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(7);
                            movementOffsets = tileMovementVectors.getVectors(3, "FFH");
                            gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(movementOffsets[movementIndex]);
                            switchThreshold = 5;
                        }
                    }
                }
                else
                {
                }
            }
        }
        public bool checkMove(GameInit gameInit, KeyHandler keyHandler, ContentHandler content)
        {
            int direction = getGreatestDirection(keyHandler);

            if (direction == 0)
            {
                gameInit.getParty().getPartyMembers()[0].setFacingDirection(0);
                if (keyHandler.getUpTime() < TURN_THRESHOLD)
                {
                    return false;
                }
                else
                {
                    if (checkHeight(gameInit, -1, 0) && checkAvailability(gameInit, -1, 0))
                    {
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
            }
            else if (direction == 1)
            {
                gameInit.getParty().getPartyMembers()[0].setFacingDirection(1);
                if (keyHandler.getDownTime() < TURN_THRESHOLD)
                {
                    return false;
                }
                else
                {
                    if (checkHeight(gameInit, 1, 0) && checkAvailability(gameInit, 1, 0))
                    {
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
            }
            else if (direction == 2)
            {
                gameInit.getParty().getPartyMembers()[0].setFacingDirection(2);
                if (keyHandler.getRightTime() < TURN_THRESHOLD)
                {
                    return false;
                }
                else
                {
                    if (checkHeight(gameInit, 0, -1) && checkAvailability(gameInit, 0, -1))
                    {
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
            }
            else if (direction == 3)
            {
                gameInit.getParty().getPartyMembers()[0].setFacingDirection(3);
                if (keyHandler.getLeftTime() < TURN_THRESHOLD)
                {
                    return false;
                }
                else
                {
                    if (checkHeight(gameInit, 0, 1) && checkAvailability(gameInit, 0, 1))
                    {
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
            }
            else
            {
                return false;
            }
        }
Exemple #16
0
        private void updateFreeRoamPlayerLogic(GameInit gameInit, KeyHandler keyHandler, ContentHandler content)
        {
            //Console.WriteLine("PLAYER X: " + gameInit.getParty().getPartyMembers()[0].getX());
            //Console.WriteLine("PLAYER Y: " + gameInit.getParty().getPartyMembers()[0].getY());
            //Console.WriteLine("HEIGHT: " + gameInit.getParty().getPartyMembers()[0].getHeight());
            if (movementHandler.isMoving())
            {
                movementHandler.updateMove(gameInit);
            }
            else if (transitionHandler.isTransitioning())
            {
                transitionHandler.continueTransition(gameInit);
                drawColor = transitionHandler.getFadeColor();
            }
            else if (actionHandler.isActivating())
            {
                actionHandler.continueActivation(gameInit);

                if (actionHandler.isTransitionReady())
                {
                    transitionHandler.startTransition(gameInit, (Door)actionHandler.getTransitioningObject());
                }
            }
            else if (actionHandler.showBigChat())
            {
            }
            else if (actionHandler.showChatWindow())
            {
                actionHandler.continueChatWindow(gameInit, keyHandler);
            }
            else
            {
                if (!actionHandler.checkActions(gameInit, keyHandler, content))
                {
                    if (!checkMove(gameInit, keyHandler, content))
                    {
                        int x = gameInit.getParty().getPartyMembers()[0].getX();
                        int y = gameInit.getParty().getPartyMembers()[0].getY();
                        int direction = gameInit.getParty().getPartyMembers()[0].getFacingDirection();

                        if (gameInit.getFreeRoamState().getCurrentZone().getTileMap()[x, y].isTransition() && gameInit.getFreeRoamState().getCurrentZone().getTileMap()[x, y].getTransitionDirection() == direction)
                        {
                            gameInit.getParty().getPartyMembers()[0].setFacingDirection(gameInit.getFreeRoamState().getCurrentZone().getTileMap()[x, y].getTransitionDirection());
                            transitionHandler.startTransition(gameInit, gameInit.getFreeRoamState().getCurrentZone().getTileMap()[x, y]);
                        }
                        else
                        {

                            if (direction == 0)
                            {
                                gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(0);

                                if (gameInit.getFreeRoamState().getCurrentZone().getTileMap()[x, y].isSloped())
                                {
                                    gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(new Vector2(0, 4));
                                }
                                else
                                {
                                    gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(new Vector2(0, 0));
                                }
                            }
                            else if (direction == 1)
                            {
                                gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(1);

                                if (gameInit.getFreeRoamState().getCurrentZone().getTileMap()[x, y].isSloped())
                                {
                                    gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(new Vector2(0, 4));
                                }
                                else
                                {
                                    gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(new Vector2(0, 0));
                                }
                            }
                            else if (direction == 2)
                            {
                                gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(2);

                                if (gameInit.getFreeRoamState().getCurrentZone().getTileMap()[x, y].isSloped())
                                {
                                    gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(new Vector2(0, 4));
                                }
                                else
                                {
                                    gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(new Vector2(0, 0));
                                }
                            }
                            else if (direction == 3)
                            {
                                gameInit.getParty().getPartyMembers()[0].getCharacterAnimations().setNewAnimation(3);

                                if (gameInit.getFreeRoamState().getCurrentZone().getTileMap()[x, y].isSloped())
                                {
                                    gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(new Vector2(0, 4));
                                }
                                else
                                {
                                    gameInit.getParty().getPartyMembers()[0].setTileDrawOffset(new Vector2(0, 0));
                                }
                            }
                        }

                    }
                    else
                    {
                        movementHandler.movePlayer(gameInit);
                    }
                }
                else
                {
                }
            }
        }
Exemple #17
0
 private void updateFreeRoamLogic(GameInit gameInit, KeyHandler keyHandler, ContentHandler content)
 {
     updateFreeRoamPlayerLogic(gameInit, keyHandler, content);
 }
Exemple #18
0
 private void updateBattleLogic(GameInit gameInit, KeyHandler keyHandler, ContentHandler content)
 {
 }
Exemple #19
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            npcAnimationContent = new ContentManager(Content.ServiceProvider, Content.RootDirectory);
            menuContent = new ContentManager(Content.ServiceProvider, Content.RootDirectory);
            zoneContent = new ContentManager(Content.ServiceProvider, Content.RootDirectory);
            battleContent = new ContentManager(Content.ServiceProvider, Content.RootDirectory);

            game = new GameInit();
            debugger = new Debugger();
            contentHandler = new ContentHandler(npcAnimationContent, menuContent, zoneContent, battleContent);
            paintHandler = new PaintHandler();
            keyHandler = new KeyHandler();
            logicHandler = new LogicHandler();
            logicHandler.loadGame(game, contentHandler);
            base.Initialize();
        }
        private bool checkAvailability(GameInit gameInit, int xChange, int yChange)
        {
            int newX = gameInit.getParty().getPartyMembers()[0].getX() + xChange;
            int newY = gameInit.getParty().getPartyMembers()[0].getY() + yChange;

            if (newX >= 0 && newX < gameInit.getFreeRoamState().getCurrentZone().getTileWidth())
            {
                if (newY >= 0 && newY < gameInit.getFreeRoamState().getCurrentZone().getTileHeight())
                {
                    bool filledWithObject = gameInit.getFreeRoamState().getCurrentZone().getTrafficMap().getObjectBooleanMap()[newX, newY];
                    bool filledWithChar = gameInit.getFreeRoamState().getCurrentZone().getTrafficMap().getCharacterBooleanMap()[newX, newY];

                    if (filledWithChar || filledWithObject)
                    {
                        return false;
                    }
                    else
                    {
                        return true;
                    }
                }
            }
            return false;
        }
Exemple #21
0
        private void drawFreeRoamState(SpriteBatch spriteBatch, GameInit gameInit, ContentHandler contentHandler, Color color)
        {
            Zone currentZone = gameInit.getFreeRoamState().getCurrentZone();
            List<Vector2> orderedTileList = currentZone.getTileLocations();
            List<int> orderedImageList = currentZone.getImageIdentifiers();
            List<Tile> orderedTiles = currentZone.getOrderedTiles();

            for (int i = orderedTileList.Count - 1; i >= 0; i--)
            {
                Tile currentTile = orderedTiles[i];
                int heightDiff = gameInit.getParty().getPartyMembers()[0].getHeight() - currentTile.getWalkingHeight();
                int xDiff = gameInit.getParty().getPartyMembers()[0].getX() - (int)orderedTileList[i].X;
                int yDiff = gameInit.getParty().getPartyMembers()[0].getY() - (int)orderedTileList[i].Y;
                Vector2 playerOffset = gameInit.getParty().getPartyMembers()[0].getTileDrawOffset();

                Vector2 drawLoc = -playerOffset + NORMALPLAYERDRAWLOCATION + TILEOFFSET + new Vector2((TILESIZE.X / 2) * (xDiff + yDiff), (TILESIZE.Y / 2) * (-xDiff + yDiff) + TILETHICKNESS * heightDiff);

                if (currentTile.isSloped())
                {
                    int direction = currentTile.getSlopedOrientation();
                    if (direction == 0)
                    {
                        if (checkIfDisplay(drawLoc, TILESIZE.X, TILESIZE.Y))
                        {
                            spriteBatch.Draw(contentHandler.getRegionContent()[gameInit.getFreeRoamState().getCurrentRegion()].getTopLeftSlope()[orderedImageList[i]], drawLoc, color);
                        }
                    }
                    else if (direction == 1)
                    {
                        if (checkIfDisplay(drawLoc, TILESIZE.X, TILESIZE.Y))
                        {
                            spriteBatch.Draw(contentHandler.getRegionContent()[gameInit.getFreeRoamState().getCurrentRegion()].getTopRightSlope()[orderedImageList[i]], drawLoc, color);
                        }
                    }
                    else if (direction == 2)
                    {
                        if (checkIfDisplay(drawLoc, TILESIZE.X, TILESIZE.Y))
                        {
                            spriteBatch.Draw(contentHandler.getRegionContent()[gameInit.getFreeRoamState().getCurrentRegion()].getBottomRightSlope()[orderedImageList[i]], drawLoc, color);
                        }
                    }
                    else if (direction == 3)
                    {
                        if (checkIfDisplay(drawLoc, TILESIZE.X, TILESIZE.Y))
                        {
                            spriteBatch.Draw(contentHandler.getRegionContent()[gameInit.getFreeRoamState().getCurrentRegion()].getBottomLeftSlope()[orderedImageList[i]], drawLoc, color);
                        }
                    }
                    else if (direction == 4)
                    {
                        if (checkIfDisplay(drawLoc, TILESIZE.X, TILESIZE.Y))
                        {
                            spriteBatch.Draw(contentHandler.getRegionContent()[gameInit.getFreeRoamState().getCurrentRegion()].getTopSlope()[orderedImageList[i]], drawLoc, color);
                        }
                    }
                    else if (direction == 5)
                    {
                        if (checkIfDisplay(drawLoc, TILESIZE.X, TILESIZE.Y))
                        {
                            spriteBatch.Draw(contentHandler.getRegionContent()[gameInit.getFreeRoamState().getCurrentRegion()].getBottomSlope()[orderedImageList[i]], drawLoc, color);
                        }
                    }
                    else if (direction == 6)
                    {
                        if (checkIfDisplay(drawLoc, TILESIZE.X, TILESIZE.Y))
                        {
                            spriteBatch.Draw(contentHandler.getRegionContent()[gameInit.getFreeRoamState().getCurrentRegion()].getRightSlope()[orderedImageList[i]], drawLoc, color);
                        }
                    }
                    else if (direction == 7)
                    {
                        if (checkIfDisplay(drawLoc, TILESIZE.X, TILESIZE.Y))
                        {
                            spriteBatch.Draw(contentHandler.getRegionContent()[gameInit.getFreeRoamState().getCurrentRegion()].getLeftSlope()[orderedImageList[i]], drawLoc, color);
                        }
                    }
                }
                else
                {
                    if (checkIfDisplay(drawLoc, TILESIZE.X, TILESIZE.Y + TILETHICKNESS * (Math.Abs(heightDiff) - 1)))
                    {
                        spriteBatch.Draw(contentHandler.getRegionContent()[gameInit.getFreeRoamState().getCurrentRegion()].getTileImages()[orderedImageList[i]], drawLoc, color);
                    }
                }

                // change this to look at next tiles
                if (orderedTileList[i].X == currentZone.getTileWidth() - 1)
                {
                    for (int j = 0; j < currentTile.getWalkingHeight(); j++)
                    {
                        Vector2 leftEdgeLoc = drawLoc + new Vector2(0, TILESIZE.Y / 2 + TILETHICKNESS * (j + 1));

                        if (checkIfDisplay(leftEdgeLoc, EDGESIZE.X, EDGESIZE.Y))
                        {
                            spriteBatch.Draw(contentHandler.getRegionContent()[gameInit.getFreeRoamState().getCurrentRegion()].getLeftWallImages()[orderedImageList[i]], leftEdgeLoc, color);
                        }

                    }

                }
                else
                {
                    int leftHeightDiff = currentTile.getWalkingHeight() - currentZone.getTileMap()[(int)orderedTileList[i].X + 1, (int)orderedTileList[i].Y].getWalkingHeight();

                    if (leftHeightDiff > 1)
                    {
                        for (int j = 0; j < leftHeightDiff - 1; j++)
                        {
                            Vector2 leftEdgeLoc = drawLoc + new Vector2(0, TILESIZE.Y / 2 + TILETHICKNESS * (j + 1));

                            if (checkIfDisplay(leftEdgeLoc, EDGESIZE.X, EDGESIZE.Y))
                            {
                                spriteBatch.Draw(contentHandler.getRegionContent()[gameInit.getFreeRoamState().getCurrentRegion()].getLeftWallImages()[orderedImageList[i]], leftEdgeLoc, color);
                            }
                        }
                    }
                }

                if (orderedTileList[i].Y == 0)
                {
                    for (int j = 0; j < currentTile.getWalkingHeight(); j++)
                    {
                        Vector2 rightEdgeLoc = drawLoc + new Vector2(0, TILESIZE.Y / 2 + TILETHICKNESS * (j + 1)) + new Vector2(TILESIZE.X / 2, 0);

                        if (checkIfDisplay(rightEdgeLoc, EDGESIZE.X, EDGESIZE.Y))
                        {
                            spriteBatch.Draw(contentHandler.getRegionContent()[gameInit.getFreeRoamState().getCurrentRegion()].getRightWallImages()[orderedImageList[i]], rightEdgeLoc, color);
                        }
                    }
                }
                else
                {
                    int rightHeightDiff = currentTile.getWalkingHeight() - currentZone.getTileMap()[(int)orderedTileList[i].X, (int)orderedTileList[i].Y - 1].getWalkingHeight();

                    if (rightHeightDiff > 1)
                    {
                        for (int j = 0; j < rightHeightDiff - 1; j++)
                        {
                            Vector2 rightEdgeLoc = drawLoc + new Vector2(0, TILESIZE.Y / 2 + TILETHICKNESS * (j + 1)) + new Vector2(TILESIZE.X / 2, 0);

                            if (checkIfDisplay(rightEdgeLoc, EDGESIZE.X, EDGESIZE.Y))
                            {
                                spriteBatch.Draw(contentHandler.getRegionContent()[gameInit.getFreeRoamState().getCurrentRegion()].getRightWallImages()[orderedImageList[i]], rightEdgeLoc, color);
                            }
                        }
                    }
                }

                if (gameInit.getFreeRoamState().getCurrentZone().getTrafficMap().getObjectBooleanMap()[(int)orderedTileList[i].X, (int)orderedTileList[i].Y])
                {
                    ManipulatableObject obj = gameInit.getFreeRoamState().getCurrentZone().getTrafficMap().getObjectMap()[(int)orderedTileList[i].X, (int)orderedTileList[i].Y];
                    Texture2D texture = contentHandler.getRegionContent()[gameInit.getFreeRoamState().getCurrentRegion()].getObjectContent()[obj.getObjectAnimation().getID()];
                    int rectX = obj.getObjectAnimation().getColumn() * (int)obj.getObjectAnimation().getSectionSize().X;
                    int rectY = obj.getObjectAnimation().getRow() * (int)obj.getObjectAnimation().getSectionSize().Y;
                    int xSize = (int)obj.getObjectAnimation().getSpriteSize().X;
                    int ySize = (int)obj.getObjectAnimation().getSpriteSize().Y;
                    Rectangle rect = new Rectangle(rectX, rectY, xSize, ySize);
                    spriteBatch.Draw(texture, drawLoc + obj.getDrawOffset(), rect, color);
                }

                // do the same for characters

                if (gameInit.getFreeRoamState().getCurrentZone().getTrafficMap().getCharacterBooleanMap()[(int)orderedTileList[i].X, (int)orderedTileList[i].Y])
                {
                    Character character = gameInit.getFreeRoamState().getCurrentZone().getTrafficMap().getCharacterMap()[(int)orderedTileList[i].X, (int)orderedTileList[i].Y];

                    if (character.getX() == orderedTileList[i].X && character.getY() == orderedTileList[i].Y)
                    {
                        Texture2D texture = contentHandler.getCharacterContent().getSpriteSheets()[character.getType()];
                        int rectX = character.getCharacterAnimations().getCurrentAnimationColumn() * (int)character.getCharacterAnimations().getAnimations().getSectionSize().X;
                        int rectY = character.getCharacterAnimations().getCurrentAnimationRow() * (int)character.getCharacterAnimations().getAnimations().getSectionSize().Y;
                        int xSize = (int)character.getCharacterAnimations().getAnimations().getSpriteSize().X;
                        int ySize = (int)character.getCharacterAnimations().getAnimations().getSpriteSize().Y;

                        if (checkIfDisplay(drawLoc + character.getTileDrawOffset() - TILEOFFSET, (float)xSize, (float)ySize))
                        {
                            Rectangle rect = new Rectangle(rectX, rectY, xSize, ySize);
                            spriteBatch.Draw(texture, drawLoc + character.getTileDrawOffset() - TILEOFFSET, rect, color);
                        }
                    }
                }

                if (gameInit.getFreeRoamState().showChatWindow())
                {
                    SpriteFont chatBoxFont = contentHandler.getChatContentHandler().getChatBoxFont();
                    string message = gameInit.getFreeRoamState().getMessage();
                    int size = (int)chatBoxFont.MeasureString(message).X;

                    int index;

                    if (size > 200)
                    {
                        index = size / 20 - 4 + 16;
                    }
                    else
                    {
                        index = size / 10 - 4;
                    }

                    if (index < 0)
                    {
                        index = 0;
                    }
                    else if (index >= contentHandler.getChatContentHandler().getChatBoxes().Count)
                    {
                        index = contentHandler.getChatContentHandler().getChatBoxes().Count - 1;
                    }

                    Vector2 chatDrawLoc;

                    int direction = gameInit.getParty().getPartyMembers()[0].getFacingDirection();

                    if (direction == 0 || direction == 3)
                    {
                        if (size > 200)
                        {
                            chatDrawLoc = BIGBOTDRAW - new Vector2((size - 200) / 2, 0);
                        }
                        else
                        {
                            chatDrawLoc = SMALLBOTDRAW - new Vector2(size / 2, 0);
                        }
                    }
                    else
                    {
                        if (size > 200)
                        {
                            chatDrawLoc = BIGTOPDRAW - new Vector2((size - 200)/ 2, 0);
                        }
                        else
                        {
                            chatDrawLoc = SMALLTOPDRAW - new Vector2(size / 2 , 0);
                        }
                    }

                    spriteBatch.Draw(contentHandler.getChatContentHandler().getChatBox(index), chatDrawLoc, Color.White);

                    int distance = 0;
                    int line = 0;

                    for (int j = 0; j < gameInit.getFreeRoamState().getParsedMessage().Count; j++)
                    {
                        string currentString = gameInit.getFreeRoamState().getParsedMessage()[j];

                        if (distance + (int)chatBoxFont.MeasureString(currentString).X > 50 + (index % 16) * 10)
                        {
                            distance = 0;
                            line++;
                        }

                        spriteBatch.DrawString(chatBoxFont, currentString, chatDrawLoc + CHATWINDOWOFFSET + new Vector2(distance, 20 * line), Color.White);
                        distance += (int)chatBoxFont.MeasureString(currentString).X;
                    }

                    List<string> options = gameInit.getFreeRoamState().getOptions();

                    if (options.Count != 0)
                    {
                        if (direction == 0 || direction == 3)
                        {
                            chatDrawLoc = BOTOPTION;
                        }
                        else
                        {
                            chatDrawLoc = TOPOPTION;
                        }

                        spriteBatch.Draw(contentHandler.getChatContentHandler().getOptionBox(options.Count), chatDrawLoc, Color.White);
                        line = 0;

                        for (int j = 0; j < options.Count; j++)
                        {
                            spriteBatch.DrawString(chatBoxFont, options[j], drawLoc + CHATWINDOWOFFSET + new Vector2(0, line * 20), Color.White);
                            line++;
                        }
                    }
                    else
                    {
                    }
                }
            }
        }
        private bool checkHeight(GameInit gameInit, int xChange, int yChange)
        {
            int newX = gameInit.getParty().getPartyMembers()[0].getX() + xChange;
            int newY = gameInit.getParty().getPartyMembers()[0].getY() + yChange;

            if (newX >= 0 && newX < gameInit.getFreeRoamState().getCurrentZone().getTileWidth())
            {
                if (newY >= 0 && newY < gameInit.getFreeRoamState().getCurrentZone().getTileHeight())
                {
                    int heightDiff = Math.Abs(gameInit.getParty().getPartyMembers()[0].getHeight() - gameInit.getFreeRoamState().getCurrentZone().getTileMap()[newX, newY].getWalkingHeight());

                    if (heightDiff <= HEIGHT_THRESHOLD)
                    {
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
            }
            return false;
        }
Exemple #23
0
 private void drawBattleState(SpriteBatch spriteBatch, GameInit gameInit, ContentHandler contentHandler, Color color)
 {
 }
Exemple #24
0
 public void updateObjects(GameInit gameInit, ContentHandler content)
 {
 }
Exemple #25
0
        public void finishActivation(GameInit gameInit)
        {
            for (int i = 0; i < finishedObjects.Count; i++)
            {
                finishedObjects[i].finishActivation(gameInit);
                if (finishedObjects[i].isTransitionReady())
                {
                    transitionReady = true;
                    transitioningObject = finishedObjects[i];
                }

                // set chat window stuff here
            }

            if (activatingObjects.Count == 0)
            {
                activating = false;
            }
        }
 public void startTransition(GameInit gameInit, Door door)
 {
     transitioning = true;
     fadeOut = true;
     fadeCounter = 0;
     destination = door.getDestination();
     regionTrans = false;
     destinationTile = door.getDestinationTile();
 }
Exemple #27
0
        private bool checkMainAction(GameInit gameInit, KeyHandler keyHandler)
        {
            int direction = gameInit.getParty().getPartyMembers()[0].getFacingDirection();

            if (direction == 0)
            {
                int targetX = gameInit.getParty().getPartyMembers()[0].getX() - 1;
                int targetY = gameInit.getParty().getPartyMembers()[0].getY();

                if (targetX < 0)
                {
                    return false;
                }
                else
                {
                    checkForInteract(gameInit, targetX, targetY);
                }
            }
            else if (direction == 1)
            {
                int targetX = gameInit.getParty().getPartyMembers()[0].getX() + 1;
                int targetY = gameInit.getParty().getPartyMembers()[0].getY();

                if (targetX >= gameInit.getFreeRoamState().getCurrentZone().getTileWidth())
                {
                    return false;
                }
                else
                {
                    checkForInteract(gameInit, targetX, targetY);
                }
            }
            else if (direction == 2)
            {
                int targetX = gameInit.getParty().getPartyMembers()[0].getX();
                int targetY = gameInit.getParty().getPartyMembers()[0].getY() - 1;

                if (targetY < 0)
                {
                    return false;
                }
                else
                {
                    checkForInteract(gameInit, targetX, targetY);
                }
            }
            else if (direction == 3)
            {
                int targetX = gameInit.getParty().getPartyMembers()[0].getX();
                int targetY = gameInit.getParty().getPartyMembers()[0].getY() + 1;

                if (targetY >= gameInit.getFreeRoamState().getCurrentZone().getTileHeight())
                {
                    return false;
                }
                else
                {
                    checkForInteract(gameInit, targetX, targetY);
                }
            }
            else
            {
                return false;
            }
            return false;
        }
        public void transition(GameInit gameInit)
        {
            if (regionTrans)
            {
            }
            else
            {
                int x = gameInit.getParty().getPartyMembers()[0].getX();
                int y = gameInit.getParty().getPartyMembers()[0].getY();

                gameInit.getFreeRoamState().getCurrentZone().clearCharacter(x, y);
                gameInit.getFreeRoamState().setCurrentZone(destination);
                gameInit.getParty().getPartyMembers()[0].setXPosition((int)destinationTile.X);
                gameInit.getParty().getPartyMembers()[0].setYPosition((int)destinationTile.Y);
                gameInit.getParty().getPartyMembers()[0].setHeight(gameInit.getFreeRoamState().getCurrentZone().getTileMap()[(int)destinationTile.X, (int)destinationTile.Y].getWalkingHeight());
                gameInit.getFreeRoamState().getCurrentZone().addCharacter(gameInit.getParty().getPartyMembers()[0], (int)destinationTile.X, (int)destinationTile.Y);
                gameInit.getFreeRoamState().getCurrentZone().initializeObjects();
            }
        }
 public void startTransition(GameInit gameInit, Tile currentTile)
 {
     transitioning = true;
     fadeOut = true;
     fadeCounter = 0;
     destination = currentTile.getDestination();
     regionTrans = currentTile.isRegionTransition();
     destinationTile = currentTile.getDestinationTile();
 }
Exemple #30
0
 private bool checkMenu(GameInit gameInit, KeyHandler keyHandler, ContentHandler content)
 {
     return true;
 }