Ejemplo n.º 1
0
        private string buildImageFullPath(string assetName, DGlobal.MapDistances distance, DGlobal.MapPositions position, DGlobal.MapOrientations orientation)
        {
            string imageFullPath;

            imageFullPath = "data/img/tiles/" + assetName + "_" + DGlobal.mapDistanceToString(distance) + "_" + DGlobal.mapPositionToString(position) + "_" + DGlobal.mapOrientationToString(orientation) + ".png";

            return(imageFullPath);
        }
Ejemplo n.º 2
0
        private string buildImageFullPath(string assetName, DGlobal.MapDistances distance, DGlobal.MapPositions position, DGlobal.CharacterPieces piece)
        {
            string imageFullPath;

            imageFullPath = "data/img/character/" + assetName + "_" + DGlobal.mapDistanceToString(distance) + "_" + DGlobal.mapPositionToString(position) + "_" + DGlobal.characterPieceToString(piece) + ".png";

            return(imageFullPath);
        }
Ejemplo n.º 3
0
        private void drawTileOrientation(int x, int y, DGlobal.MapDistances distance, DGlobal.MapPositions position, DGlobal.MapOrientations orientation, DGlobal.MapOrientations lookOrientation)
        {
            int positionX = x;
            int positionY = y;

            DGlobal.MapOrientations drawingOrientation = orientation;

            switch (lookOrientation)
            {
            case DGlobal.MapOrientations.WEST:
                DGlobal.turnRight(ref drawingOrientation);
                break;

            case DGlobal.MapOrientations.EAST:
                DGlobal.turnLeft(ref drawingOrientation);
                break;

            case DGlobal.MapOrientations.SOUTH:
                DGlobal.turnBack(ref drawingOrientation);
                break;
            }

            switch (position)
            {
            case DGlobal.MapPositions.RIGHT1:
                DGlobal.moveRight(lookOrientation, ref positionX, ref positionY, 1);
                break;

            case DGlobal.MapPositions.RIGHT2:
                DGlobal.moveRight(lookOrientation, ref positionX, ref positionY, 2);
                break;

            case DGlobal.MapPositions.LEFT1:
                DGlobal.moveLeft(lookOrientation, ref positionX, ref positionY, 1);
                break;

            case DGlobal.MapPositions.LEFT2:
                DGlobal.moveLeft(lookOrientation, ref positionX, ref positionY, 2);
                break;
            }

            DGlobal.moveForward(lookOrientation, ref positionX, ref positionY, (int)distance);

            if (positionX >= 0 && positionX < this.mWidth && positionY >= 0 && positionY < this.mHeight)
            {
                if (this.mMapData[positionX, positionY, (int)orientation] > 0 && this.mTileset[(this.mMapData[positionX, positionY, (int)orientation]) - 1, (int)distance, (int)position, (int)drawingOrientation] != null)
                {
                    this.mGraphics.drawImage(this.mTileset[(this.mMapData[positionX, positionY, (int)orientation]) - 1, (int)distance, (int)position, (int)drawingOrientation]);
                }
            }
        }
Ejemplo n.º 4
0
        private void drawTile(int x, int y, DGlobal.MapDistances distance, DGlobal.MapPositions position, DGlobal.MapOrientations lookOrientation)
        {
            DGlobal.MapOrientations orientation = lookOrientation;

            if (position == DGlobal.MapPositions.CENTER)
            {
                this.drawTileOrientation(x, y, distance, position, orientation, lookOrientation);
                DGlobal.turnLeft(ref orientation);
                this.drawTileOrientation(x, y, distance, position, orientation, lookOrientation);
                DGlobal.turnRight(ref orientation);
                DGlobal.turnRight(ref orientation);
                this.drawTileOrientation(x, y, distance, position, orientation, lookOrientation);
                this.drawTileOrientation(x, y, distance, position, DGlobal.MapOrientations.FLOOR, lookOrientation);
                this.drawTileOrientation(x, y, distance, position, DGlobal.MapOrientations.CEIL, lookOrientation);
                this.drawCharacter(x, y, distance, position, lookOrientation);
                DGlobal.turnRight(ref orientation);
                this.drawTileOrientation(x, y, distance, position, orientation, lookOrientation);
            }
            else if (position == DGlobal.MapPositions.RIGHT1 || position == DGlobal.MapPositions.RIGHT2)
            {
                this.drawTileOrientation(x, y, distance, position, orientation, lookOrientation);
                DGlobal.turnRight(ref orientation);
                this.drawTileOrientation(x, y, distance, position, orientation, lookOrientation);
                DGlobal.turnRight(ref orientation);
                this.drawTileOrientation(x, y, distance, position, orientation, lookOrientation);
                this.drawTileOrientation(x, y, distance, position, DGlobal.MapOrientations.FLOOR, lookOrientation);
                this.drawTileOrientation(x, y, distance, position, DGlobal.MapOrientations.CEIL, lookOrientation);
                this.drawCharacter(x, y, distance, position, lookOrientation);
                DGlobal.turnRight(ref orientation);
                this.drawTileOrientation(x, y, distance, position, orientation, lookOrientation);
            }
            else if (position == DGlobal.MapPositions.LEFT1 || position == DGlobal.MapPositions.LEFT2)
            {
                this.drawTileOrientation(x, y, distance, position, orientation, lookOrientation);
                DGlobal.turnLeft(ref orientation);
                this.drawTileOrientation(x, y, distance, position, orientation, lookOrientation);
                DGlobal.turnLeft(ref orientation);
                this.drawTileOrientation(x, y, distance, position, orientation, lookOrientation);
                this.drawTileOrientation(x, y, distance, position, DGlobal.MapOrientations.FLOOR, lookOrientation);
                this.drawTileOrientation(x, y, distance, position, DGlobal.MapOrientations.CEIL, lookOrientation);
                this.drawCharacter(x, y, distance, position, lookOrientation);
                DGlobal.turnLeft(ref orientation);
                this.drawTileOrientation(x, y, distance, position, orientation, lookOrientation);
            }
        }
Ejemplo n.º 5
0
        private void drawCharacter(int x, int y, DGlobal.MapDistances distance, DGlobal.MapPositions position, DGlobal.MapOrientations lookOrientation)
        {
            DCharacter character = null;

            int positionX = x;
            int positionY = y;

            switch (position)
            {
            case DGlobal.MapPositions.RIGHT1:
                DGlobal.moveRight(lookOrientation, ref positionX, ref positionY, 1);
                break;

            case DGlobal.MapPositions.RIGHT2:
                DGlobal.moveRight(lookOrientation, ref positionX, ref positionY, 2);
                break;

            case DGlobal.MapPositions.LEFT1:
                DGlobal.moveLeft(lookOrientation, ref positionX, ref positionY, 1);
                break;

            case DGlobal.MapPositions.LEFT2:
                DGlobal.moveLeft(lookOrientation, ref positionX, ref positionY, 2);
                break;
            }

            DGlobal.moveForward(lookOrientation, ref positionX, ref positionY, (int)distance);

            foreach (DCharacter characterTMP in this.mCharacters)
            {
                if (characterTMP.getPositionX() == positionX && characterTMP.getPositionY() == positionY)
                {
                    character = characterTMP;
                    break;
                }
            }

            if (character != null)
            {
                character.draw(distance, position);
            }
        }