Beispiel #1
0
 public GameEngine(Blinky blinky, Clyde clyde, Inky inky, Pinky pinky)
 {
     ghosts.Add(blinky);
     ghosts.Add(clyde);
     ghosts.Add(inky);
     ghosts.Add(pinky);
 }
Beispiel #2
0
        public Level(Form form, LevelDecoder decoder)
        {
            Form                             = form;
            RendererPanel                    = new RendererPanel(Render);
            RendererPanel.Width              = 512;
            RendererPanel.Height             = 512;
            RendererPanel.Location           = new Point(0, 0);
            Player                           = new Player(RendererPanel, this, RendererPanel.Width / 32, RendererPanel.Height / 32);
            Pinky                            = new Pinky(RendererPanel, this, RendererPanel.Width / 32, RendererPanel.Height / 32);
            Inky                             = new Inky(RendererPanel, this, RendererPanel.Width / 32, RendererPanel.Height / 32);
            Blinky                           = new Blinky(RendererPanel, this, RendererPanel.Width / 32, RendererPanel.Height / 32);
            Clyde                            = new Clyde(RendererPanel, this, RendererPanel.Width / 32, RendererPanel.Height / 32);
            RendererPanel.PlayerRenderAction = Player.Render;
            RendererPanel.PinkyRenderAction  = Pinky.Render;
            RendererPanel.InkyRenderAction   = Inky.Render;
            RendererPanel.BlinkyRenderAction = Blinky.Render;
            RendererPanel.ClydeRenderAction  = Clyde.Render;
            RendererPanel.DoRender();
            form.Controls.Add(RendererPanel);
            KeyInputHandler = new KeyInputHandler(form, true, ThreadingMode.None);
            EventKeyInput eventKeyInput = new EventKeyInput();

            eventKeyInput.KeyInput += EventKeyInput_KeyInput;
            KeyInputHandler.RegisterKeyInput(eventKeyInput);
            KeyInputHandler.Start();
            form.FormClosing += Form_FormClosing;
            Grid              = decoder.DecodeLevel();
            Player.Spawn(16, 16);
            Pinky.Spawn(32, 80);
            Inky.Spawn(48, 80);
            Blinky.Spawn(64, 80);
            Clyde.Spawn(80, 80);
        }
Beispiel #3
0
 public Collision(Pinky pinky, Blinky blinky, Inky inky, Clyde clyde, IPacMan pacMan, GUI gui)
 {
     this.gui = gui;
     pacman   = pacMan;
     ghosts.Add(pinky);
     ghosts.Add(inky);
     ghosts.Add(blinky);
     ghosts.Add(clyde);
 }
Beispiel #4
0
        public void TestCalculateTargetCell1()
        {
            Game   game   = new Game();
            Inky   inky   = (Inky)game.Ghosts[2];
            Blinky blinky = (Blinky)game.Ghosts[0];

            blinky.SetX(10);
            blinky.SetY(16);

            Cell cell = inky.CalculateTargetCell();

            Assert.AreEqual(cell, game.Level.Map[27, 30]);
        }
Beispiel #5
0
 public Game(string Id)
 {
     ID         = Id;
     map        = new Maze();
     pacMan     = new PacMan(map, new Position(13, 17));
     blinky     = new Blinky(pacMan, map, new Position(10, 11));
     pinky      = new Pinky(pacMan, map, new Position(11, 14));
     gui        = new GUI(map);
     clyde      = new Clyde(pacMan, map, new Position(11, 15));
     inky       = new Inky(pacMan, map, new Position(12, 15));
     collision  = new Collision(pinky, blinky, inky, clyde, pacMan, gui);
     gameEngine = new GameEngine(blinky, clyde, inky, pinky);
 }
Beispiel #6
0
        public void TestCalculateTargetCell6()
        {
            Game   game   = new Game();
            Inky   inky   = (Inky)game.Ghosts[2];
            Blinky blinky = (Blinky)game.Ghosts[0];

            blinky.SetX(25);
            blinky.SetY(16);
            game.Player.Direction = Direction.Right;

            Cell cell = inky.CalculateTargetCell();

            Assert.AreEqual(cell, game.Level.Map[12, 30]);
        }
Beispiel #7
0
        public void SetupBoard(TileInfo[][] boardTiles, Vector pacmanPosition, Vector positionInFrontOfPrision, Vector positionInsideOfPrision)
        {
            this.pacmanPosition           = pacmanPosition;
            this.positionInFrontOfPrision = positionInFrontOfPrision;
            this.positionInsideOfPrision  = positionInsideOfPrision;

            Board  = new Board(boardTiles, positionInFrontOfPrision, positionInsideOfPrision);
            Pacman = new Pacman(pacmanPosition, Board);
            Blinky = new Blinky(positionInFrontOfPrision, Board);
            Pinky  = new Pinky(positionInsideOfPrision, Board);
            Inky   = new Inky((positionInsideOfPrision + (Vector.LEFT * 2)), Board);
            Clyde  = new Clyde((positionInsideOfPrision + (Vector.RIGHT * 2)), Board);
            XpItem = new XpItem(positionInFrontOfPrision, Board);
        }
Beispiel #8
0
        public void InitiateGame()
        {
            processColision = false;
            GameOver        = false;
            Pacman.Start(pacmanPosition);

            Blinky.Start(positionInFrontOfPrision);
            Pinky.Start(positionInsideOfPrision);
            Inky.Start(positionInsideOfPrision + Vector.LEFT * 2);
            Clyde.Start(positionInsideOfPrision + Vector.RIGHT * 2);


            WaitAndCall((int)TIME_TO_RELEASE_GHOSTS * 1000, Pinky.Unlock);
            WaitAndCall((int)TIME_TO_RELEASE_GHOSTS * 1000 * 2, Inky.Unlock);
            WaitAndCall((int)TIME_TO_RELEASE_GHOSTS * 1000 * 3, Clyde.Unlock);


            WaitAndCall((int)TIME_TO_DROP_XP_ITEM * 1000, DropXpItem);
        }
Beispiel #9
0
        /// <summary>
        /// Create a new instance of the game by initilizing all game components
        /// </summary>
        public void NewGame()
        {
            // Clear the list of all game components
            this.Components.Clear();

            // Stop all musics
            SoundManager.Instance.StopMusic();
            SoundManager.Instance.StopInvincible();

            // Create new instances of game components
            menu   = new Menu(this, pacDied ? MenuType.GAMEOVER : MenuType.START);
            maze   = new Maze(this);
            blinky = new Blinky(this);
            pinky  = new Pinky(this);
            inky   = new Inky(this);
            clyde  = new Clyde(this);

            pac = new Pac(this, maze);

            // If there was a previous level before this new game, do not reset pac's life
            if (lastPacLife > 0)
            {
                pac.Life = lastPacLife;
            }

            // (Re)-initialize GhostManager
            GhostManager.Instance.Initialize(maze, pac, blinky, new Ghost[] { pinky, inky, clyde });

            // Initialize all game components
            menu.Initialize();
            maze.Initialize();
            blinky.Initialize();
            pinky.Initialize();
            inky.Initialize();
            clyde.Initialize();
            pac.Initialize();

            // Reset pacDied attribute
            pacDied = false;
        }
Beispiel #10
0
 void ConfigureGhosts()
 {
     GameObject[] blinkyGameObjects = GameObject.FindGameObjectsWithTag("Blinky");
     foreach (GameObject blinkyGameObject in blinkyGameObjects)
     {
         Blinky blinky = blinkyGameObject.GetComponent <Blinky>();
         blinky.timeFrightened = Settings.ghostTimeFrightened;
     }
     GameObject[] inkyGameObjects = GameObject.FindGameObjectsWithTag("Inky");
     foreach (GameObject inkyGameObject in inkyGameObjects)
     {
         Inky inky = inkyGameObject.GetComponent <Inky>();
         inky.moveSpeed      = Settings.ghostMoveSpeed;
         inky.timeFrightened = Settings.ghostTimeFrightened;
     }
     GameObject[] pinkyGameObjects = GameObject.FindGameObjectsWithTag("Pinky");
     foreach (GameObject pinkyGameObject in pinkyGameObjects)
     {
         Pinky pinky = pinkyGameObject.GetComponent <Pinky>();
         pinky.moveSpeed      = Settings.ghostMoveSpeed;
         pinky.timeFrightened = Settings.ghostTimeFrightened;
     }
 }
Beispiel #11
0
    void InstantiateCell(char value, int x, int y)
    {
        GameObject cellToInstantiate = null;
        CellType?  instantiatedType  = null;
        GameObject instantiatedBox   = null;

        switch (value)
        {
        case '.':
        {
            cellToInstantiate = Instantiate(Floor, new Vector3(1 * x, 0, 1 * y), Quaternion.identity);
            instantiatedType  = CellType.Floor;
            break;
        }

        case 'g':
        {
            cellToInstantiate = Instantiate(Gate, new Vector3(1 * x, 0, 1 * y), Quaternion.identity);
            Gate     = cellToInstantiate;
            EyesCell = new Cell {
                XCoordinate = y, YCoordinate = x - 1
            };
            instantiatedType = CellType.Gate;
            break;
        }

        case 'w':
        {
            cellToInstantiate = Instantiate(Wall, new Vector3(1 * x, 0, 1 * y), Quaternion.identity);
            instantiatedType  = CellType.Wall;
            break;
        }

        case 'b':
        {
            cellToInstantiate = Instantiate(Floor, new Vector3(1 * x, 0, 1 * y), Quaternion.identity);

            blinky           = Instantiate(blinky, new Vector3(1 * x, 0, 1 * y), Quaternion.identity);
            instantiatedType = CellType.Floor;
            mapData[y, x]    = new Cell {
                Item = cellToInstantiate, Type = instantiatedType.Value, XCoordinate = y, YCoordinate = x
            };
            blinky.currentCell = mapData[y, x];
            break;
        }

        case 'p':
        {
            cellToInstantiate = Instantiate(Floor, new Vector3(1 * x, 0, 1 * y), Quaternion.identity);
            instantiatedType  = CellType.Floor;
            pinky             = Instantiate(pinky, new Vector3(1 * x, 0, 1 * y), Quaternion.identity);
            mapData[y, x]     = new Cell {
                Item = cellToInstantiate, Type = instantiatedType.Value, XCoordinate = y, YCoordinate = x
            };
            pinky.currentCell = mapData[y, x];
            break;
        }

        case 'i':
        {
            cellToInstantiate = Instantiate(Floor, new Vector3(1 * x, 0, 1 * y), Quaternion.identity);
            instantiatedType  = CellType.Floor;
            inky          = Instantiate(inky, new Vector3(1 * x, 0, 1 * y), Quaternion.identity);
            mapData[y, x] = new Cell {
                Item = cellToInstantiate, Type = instantiatedType.Value, XCoordinate = y, YCoordinate = x
            };
            inky.currentCell = mapData[y, x];
            break;
        }

        case 'c':
        {
            cellToInstantiate = Instantiate(Floor, new Vector3(1 * x, 0, 1 * y), Quaternion.identity);
            instantiatedType  = CellType.Floor;
            clyde             = Instantiate(clyde, new Vector3(1 * x, 0, 1 * y), Quaternion.identity);
            mapData[y, x]     = new Cell {
                Item = cellToInstantiate, Type = instantiatedType.Value, XCoordinate = y, YCoordinate = x
            };
            clyde.currentCell = mapData[y, x];
            break;
        }

        case 'P':
        {
            cellToInstantiate = Instantiate(Floor, new Vector3(1 * x, 0, 1 * y), Quaternion.identity, SuperParentContainer.transform);
            var playerGameobject = Instantiate(Player, new Vector3(1 * x, 0, 1 * y), Quaternion.identity);
            mainPlayer               = playerGameobject.GetComponent <PackManPlayer>();
            instantiatedType         = CellType.Floor;
            mainPlayer.ScoreText     = ScoreText;
            mainPlayer.RestartButton = RestartButton;
            mainPlayer.DeadText      = YouAreDead;
            mapData[y, x]            = new Cell {
                Item = cellToInstantiate, Type = instantiatedType.Value, XCoordinate = y, YCoordinate = x
            };
            mainPlayer.CellPosition = mapData[y, x];
            Debug.Log(mainPlayer.CellPosition);
            break;
        }

        default:
        {
            Debug.Log("Can't instantiate");
            break;
        }
        }
        mapData[y, x] = new Cell {
            Item = instantiatedBox, Type = instantiatedType.Value, XCoordinate = y, YCoordinate = x
        };
        cellToInstantiate.transform.SetParent(SuperParentContainer.transform);
    }
Beispiel #12
0
    public void ParseLevel()
    {
        foreach (var go in m_objects)
        {
            Destroy(go);
        }

        m_objects   = new List <GameObject>();
        m_text.text = string.Empty;

        string path = m_input.text;

        if (!path.EndsWith(".pac"))
        {
            path = path + ".pac";
        }
        m_input.text = path;

        path = Path.Combine(@"Assets\levels", path);

        if (!File.Exists(path))
        {
            m_text.text += "file not available!" + Environment.NewLine;
            return;
        }

        Tile[,] tiles = new Tile[0, 0];
        //int[] characterPositions = new int[10];
        List <Vector3> charpos;

        m_text.text += "parsing started:" + Environment.NewLine;
        string level, figures;

        if (Parser.IsValidLevel(path, out level, out figures, ref m_text))
        {
            m_text.text += Environment.NewLine + "start building" + Environment.NewLine;
            tiles        = Parser.ParseValidLevel(level, ref m_text);

            //characterPositions = Parser.getCharacterPositions(figures);

            charpos      = Parser.GetCharPositions();
            m_text.text += " got positions" + Environment.NewLine;

            m_text.text += level + Environment.NewLine;
        }
        else
        {
            m_input.text = "level structure not valid" + Environment.NewLine;
            return;
        }

        GameObject[,] objs = new GameObject[tiles.GetLength(0), tiles.GetLength(1)];


        // build prefabs
        for (int r = 0; r < tiles.GetLength(0); r++)
        {
            for (int c = 0; c < tiles.GetLength(1); c++)
            {
                Vector3    pos = new Vector3(c, 0f, -r);
                Quaternion rot = Quaternion.Euler(0f, tiles[r, c].Rotation, 0f);

                GameObject go = null;
                #region switch
                switch (tiles[r, c].Type)
                {
                case Tile.Element.Block:
                    go = Block;
                    break;

                case Tile.Element.Corner:
                    go = Corner;
                    break;

                case Tile.Element.Corridor:
                    go = Corridor;
                    break;

                case Tile.Element.Cross:
                    go = Cross;
                    break;

                case Tile.Element.Deadend:
                    go = DeadEnd;
                    break;

                case Tile.Element.TCross:
                    go = TCross;
                    break;

                default:
                    break;
                }
                #endregion

                var inst = Instantiate(go, pos, rot);
                m_objects.Add(inst);
                objs[r, c] = inst;
            }
        }

        m_text.text += "level building finished w/success" + Environment.NewLine;

        for (int r = 0; r < tiles.GetLength(0); r++)
        {
            for (int c = 0; c < tiles.GetLength(1); c++)
            {
                if (tiles[r, c].ltrb_open[0])
                {
                    objs[r, c].GetComponent <WayPoint>().leftWaypoint = objs[r, c - 1].GetComponent <WayPoint>();
                }

                if (tiles[r, c].ltrb_open[1])
                {
                    objs[r, c].GetComponent <WayPoint>().upWaypoint = objs[r - 1, c].GetComponent <WayPoint>();
                }

                if (tiles[r, c].ltrb_open[2])
                {
                    objs[r, c].GetComponent <WayPoint>().rightWaypoint = objs[r, c + 1].GetComponent <WayPoint>();
                }

                if (tiles[r, c].ltrb_open[3])
                {
                    objs[r, c].GetComponent <WayPoint>().downWaypoint = objs[r + 1, c].GetComponent <WayPoint>();
                }
            }
        }
        m_text.text += "added waypoints to GameObjects" + Environment.NewLine;

        for (int i = 0; i < charpos.Count; i++)
        {
            m_text.text += "  char pos fig " + (i + 1) + ": " + charpos [i].x + " " + charpos [i].y + " " + charpos [i].z + objs[(int)charpos[0].x, -(int)charpos[0].z].GetComponent <WayPoint>() + Environment.NewLine;
        }
        m_text.text += "" + objs.GetLength(0) + " - " + objs.GetLength(1) + " / " + objs.Length;

        transform.position = new Vector3((tiles.GetLength(1) - 1) / 2f, 10, -(tiles.GetLength(0) - 1) / 2f);

        Pacman = Instantiate(Pacman, charpos[0], qempty);
        Blinky = Instantiate(Blinky, charpos[1], qempty);
        Inky   = Instantiate(Inky, charpos[2], qempty);
        Pinky  = Instantiate(Pinky, charpos[3], qempty);
        Clyde  = Instantiate(Clyde, charpos[4], qempty);

        Pacman.transform.position = charpos[0];
        Blinky.transform.position = charpos[1];
        Inky.transform.position   = charpos[2];
        Pinky.transform.position  = charpos[3];
        Clyde.transform.position  = charpos[4];

        m_objects.Add(Pacman);
        m_objects.Add(Blinky);
        m_objects.Add(Inky);
        m_objects.Add(Pinky);
        m_objects.Add(Clyde);

        //Pacman = Instantiate(Pacman, new Vector3(characterPositions[0], 0, -characterPositions[1]),  new Quaternion(0, 0, 0, 0));
        //Blinky = Instantiate(Blinky, new Vector3(characterPositions[2], 0, -characterPositions[3]), new Quaternion(0, 0, 0, 0));
        //Inky = Instantiate(Inky, new Vector3(characterPositions[4], 0, -characterPositions[5]), new Quaternion(0, 0, 0, 0));
        //Pinky = Instantiate(Pinky, new Vector3(characterPositions[6], 0, -characterPositions[7]), new Quaternion(0, 0, 0, 0));
        //Clyde = Instantiate(Clyde, new Vector3(characterPositions[8], 0, -characterPositions[9]), new Quaternion(0, 0, 0, 0));


        //Pacman.GetComponent<PlayerControlScript>().currentWaypoint = m_obj[characterPositions[0], characterPositions[1]].GetComponent<WayPoint>();
        //Blinky.GetComponent<EnemyBehaviourScript>().currentWaypoint = m_obj[characterPositions[2], characterPositions[3]].GetComponent<WayPoint>();
        //Inky.GetComponent<EnemyBehaviourScript>().currentWaypoint = m_obj[characterPositions[4], characterPositions[5]].GetComponent<WayPoint>();
        //Pinky.GetComponent<EnemyBehaviourScript>().currentWaypoint = m_obj[characterPositions[6], characterPositions[7]].GetComponent<WayPoint>();
        //Clyde.GetComponent<EnemyBehaviourScript>().currentWaypoint = m_obj[characterPositions[8], characterPositions[9]].GetComponent<WayPoint>();

        Pacman.GetComponent <PlayerControlScript>().currentWaypoint  = objs[-(int)charpos[0].z, (int)charpos[0].x].GetComponent <WayPoint>();
        Blinky.GetComponent <EnemyBehaviourScript>().currentWaypoint = objs[-(int)charpos[1].z, (int)charpos[1].x].GetComponent <WayPoint>();
        Inky.GetComponent <EnemyBehaviourScript>().currentWaypoint   = objs[-(int)charpos[2].z, (int)charpos[2].x].GetComponent <WayPoint>();
        Pinky.GetComponent <EnemyBehaviourScript>().currentWaypoint  = objs[-(int)charpos[3].z, (int)charpos[3].x].GetComponent <WayPoint>();
        Clyde.GetComponent <EnemyBehaviourScript>().currentWaypoint  = objs[-(int)charpos[4].z, (int)charpos[4].x].GetComponent <WayPoint>();


        m_text.text += "instanziated characters" + Environment.NewLine;
    }
Beispiel #13
0
    void Init(bool reset)
    {
        lives = pacMan.GetComponent <Controller>().life;
        if (reset)
        {
            for (int i = 0; i < ghosts.Length; i++)
            {
                if (ghosts[i].GetComponent <Pinky>() != null)
                {
                    Pinky pinky = ghosts[i].GetComponent <Pinky>();
                    pinky.resetLevel  = true;
                    pinky.currentNode = null;
                    ghosts[i].GetComponent <Pinky>().Init(ghostSpeed, ghostFrightSpeed, ghostTunnelSpeed, frightDuration);
                }
                else if (ghosts[i].GetComponent <Blinky>() != null)
                {
                    Blinky blinky = ghosts[i].GetComponent <Blinky>();
                    blinky.currentNode = null;
                    blinky.resetLevel  = true;
                    blinky.Init(ghostSpeed, ghostFrightSpeed, ghostTunnelSpeed, frightDuration);
                }
                else if (ghosts[i].GetComponent <Inky>() != null)
                {
                    Inky inky = ghosts[i].GetComponent <Inky>();
                    inky.currentNode = null;
                    inky.resetLevel  = true;
                    inky.Init(ghostSpeed, ghostFrightSpeed, ghostTunnelSpeed, frightDuration);
                }
                else if (ghosts[i].GetComponent <Clyde>() != null)
                {
                    Clyde clyde = ghosts[i].GetComponent <Clyde>();
                    clyde.resetLevel  = true;
                    clyde.currentNode = null;
                    clyde.Init(ghostSpeed, ghostFrightSpeed, ghostTunnelSpeed, frightDuration);
                }
            }
        }
        else
        {
            for (int i = 0; i < ghosts.Length; i++)
            {
                if (ghosts[i].GetComponent <Pinky>() != null)
                {
                    Pinky pinky = ghosts[i].GetComponent <Pinky>();
                    pinky.resetLevel = false;
                    ghosts[i].GetComponent <Pinky>().Init(ghostSpeed, ghostFrightSpeed, ghostTunnelSpeed, frightDuration);
                }
                else if (ghosts[i].GetComponent <Blinky>() != null)
                {
                    Blinky blinky = ghosts[i].GetComponent <Blinky>();
                    blinky.resetLevel = false;
                    blinky.Init(ghostSpeed, ghostFrightSpeed, ghostTunnelSpeed, frightDuration);
                }
                else if (ghosts[i].GetComponent <Inky>() != null)
                {
                    Inky inky = ghosts[i].GetComponent <Inky>();
                    inky.resetLevel = false;
                    inky.release    = inkyReleaseCounter;
                    inky.Init(ghostSpeed, ghostFrightSpeed, ghostTunnelSpeed, frightDuration);
                }
                else if (ghosts[i].GetComponent <Clyde>() != null)
                {
                    Clyde clyde = ghosts[i].GetComponent <Clyde>();
                    clyde.resetLevel = false;
                    clyde.release    = clydeReleaseCounter;
                    clyde.Init(ghostSpeed, ghostFrightSpeed, ghostTunnelSpeed, frightDuration);
                }
            }

            foreach (GameObject o in objects)
            {
                if (!pacManLost)
                {
                    if (o.tag == "Pellets" || o.tag == "PelletsInner" || o.tag == "PelletsSpecial")
                    {
                        Tile tile = o.GetComponent <Tile>();
                        if (tile != null)
                        {
                            if (tile.isPellet || tile.isSuperPellet)
                            {
                                tile.GetComponent <SpriteRenderer>().enabled = true;
                                tile.isConsumed = false;
                            }
                        }
                    }
                }
            }
        }

        pacMan.Init(pacManSpeed, frightPacManSpeed, pacManDotsSpeed, frightDuration);
    }
 private void AjouterInky()
 {
     Inky.MettreAJourCoordonnée(Grille.TrouverCoordonnéeCase(14, 11));
     m_listeFantômesActifs.Add(Inky);
     m_ia.RéinitialiserInky();
 }
Beispiel #15
0
        public void move_Ghosts()
        {
            Blinky.find_target(ai_state);
            Pinky.find_target(ai_state);
            Inky.find_target(ai_state);
            Clyde.find_target(ai_state);

            //from one side to the other***********************************************************************
            //*************************************BLINKY******************************************************
            if (Blinky.x == 0 && Blinky.y == 17 && Blinky.direction == 0)
            {
                Blinky.x = 28;
            }
            if (Blinky.x == 27 && Blinky.y == 17 && Blinky.direction == 2)
            {
                Blinky.x = 0;
            }

            if (Map.intersections[Blinky.x, Blinky.y])
            {
                Blinky.direction = check_intersections(Blinky.x, Blinky.y, Blinky.target_x, Blinky.target_y, Blinky.direction);
            }
            else
            {
                Blinky.direction = check_walls(Blinky.x, Blinky.y, Blinky.target_x, Blinky.target_y, Blinky.direction);
            }


            /***********************************************************************************************
             * *******************************PINKY***************************************************/
            if (Pinky.x == 0 && Pinky.y == 17 && Pinky.direction == 0)
            {
                Pinky.x = 28;
            }
            if (Pinky.x == 27 && Pinky.y == 17 && Pinky.direction == 2)
            {
                Pinky.x = 0;
            }

            if (Map.intersections[Pinky.x, Pinky.y])
            {
                Pinky.direction = check_intersections(Pinky.x, Pinky.y, Pinky.target_x, Pinky.target_y, Pinky.direction);
            }
            else
            {
                Pinky.direction = check_walls(Pinky.x, Pinky.y, Pinky.target_x, Pinky.target_y, Pinky.direction);
            }

            //from one side to the other***********************************************************************
            //*************************************INKY******************************************************
            if (Inky.x == 0 && Inky.y == 17 && Inky.direction == 0)
            {
                Inky.x = 28;
            }
            if (Inky.x == 27 && Inky.y == 17 && Inky.direction == 2)
            {
                Inky.x = 0;
            }

            if (Map.intersections[Inky.x, Inky.y])
            {
                Inky.direction = check_intersections(Inky.x, Inky.y, Inky.target_x, Inky.target_y, Inky.direction);
            }
            else
            {
                Inky.direction = check_walls(Inky.x, Inky.y, Inky.target_x, Inky.target_y, Inky.direction);
            }


            //from one side to the other***********************************************************************
            //*************************************CLYDE******************************************************
            if (Clyde.x == 0 && Clyde.y == 17 && Clyde.direction == 0)
            {
                Clyde.x = 28;
            }
            if (Clyde.x == 27 && Clyde.y == 17 && Clyde.direction == 2)
            {
                Clyde.x = 0;
            }

            if (Map.intersections[Clyde.x, Clyde.y])
            {
                Clyde.direction = check_intersections(Clyde.x, Clyde.y, Clyde.target_x, Clyde.target_y, Clyde.direction);
            }
            else
            {
                Clyde.direction = check_walls(Clyde.x, Clyde.y, Clyde.target_x, Clyde.target_y, Clyde.direction);
            }

            Blinky.move(Blinky.direction);
            Pinky.move(Pinky.direction);
            Inky.move(Inky.direction);
            Clyde.move(Clyde.direction);
        }