Esempio n. 1
0
        static void MuevePacman(Tablero tab /*Temporal*/, Coor newPos)
        {
            tab.pers[0].pos.fil = newPos.fil;
            tab.pers[0].pos.col = newPos.col;

            tab.cas[newPos.fil, newPos.col] = (Tablero.Casilla) 0;
        }
Esempio n. 2
0
        static bool Siguiente(Coor pos, Coor dir, ref Coor newPos, Tablero tab /*Temporal*/)
        {
            bool apto = false;

            newPos.col = pos.col;
            newPos.fil = pos.fil;

            if (dir.fil == 1 && tab.cas[pos.fil + 1, pos.col] != (Tablero.Casilla) 1)
            {
                apto       = true;
                newPos.fil = pos.fil + 1;

                if (pos.fil == tab.cas.GetLength(1) - 1)
                {
                    newPos.fil = 0;
                }
            }
            else if (dir.fil == -1 && tab.cas[pos.fil - 1, pos.col] != (Tablero.Casilla) 1)
            {
                apto       = true;
                newPos.fil = pos.fil - 1;

                if (pos.fil == 0)
                {
                    newPos.fil = tab.cas.GetLength(1) - 1;
                }
            }
            else if (dir.col == 1 && tab.cas[pos.fil, pos.col + 1] != (Tablero.Casilla) 1)
            {
                apto       = true;
                newPos.col = pos.col + 1;

                if (pos.col == tab.cas.GetLength(0) - 1)
                {
                    newPos.col = 0;
                }
            }
            else if (dir.col == -1 && tab.cas[pos.fil, pos.col - 1] != (Tablero.Casilla) 1)
            {
                apto       = true;
                newPos.col = pos.col - 1;

                if (pos.col == 0)
                {
                    newPos.col = tab.cas.GetLength(0) - 1;
                }
            }

            return(apto);
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            string file = "level00.dat";

            Tablero tab = new Tablero(file);

            bool sig = false;

            Coor newPos = new Coor();

            while (true)
            {
                Dibuja(tab);

                sig = Siguiente(tab.pers[0].pos, tab.pers[0].dir, ref newPos, tab);

                MuevePacman(tab /*Temporal*/, newPos);
            }
        }
Esempio n. 4
0
        } //Por que no funciona esto

        bool Siguiente(Coor pos, Coor dir, Coor newPos)
        {
            bool apto = false;

            return(apto);
        }