Exemple #1
0
    public void GetTarget(out int x, out int y, GhostController.ghostMode currentMode, GameController c)
    {
        switch (currentMode)
        {
        case GhostController.ghostMode.kChase:
            y = c.pacmanLoc.y / 8;
            x = c.pacmanLoc.x / 8;
            if (GhostController.Dist(x, y, c.clydeLoc.x / 8, c.clydeLoc.y / 8) < 8)
            {
                y = x = 0;
            }
            break;

        case GhostController.ghostMode.kScatter:
            y = 0;
            x = 0;
            break;

        case GhostController.ghostMode.kDead:
            x = 13;
            y = 21;
            break;

        case GhostController.ghostMode.kLeavingHouse:
            x = 13;
            y = 21;
            break;

        default:         // no target
            x = y = 0;
            break;
        }
    }
Exemple #2
0
    public void GetTarget(out int x, out int y, GhostController.ghostMode currentMode, GameController c)
    {
        switch (currentMode)
        {
        case GhostController.ghostMode.kChase:
            y = c.pacmanLoc.y / 8;
            x = c.pacmanLoc.x / 8;
            break;

        case GhostController.ghostMode.kScatter:
            y = GameMaze.boardHeight - 1;
            x = GameMaze.boardWidth - 3;
            break;

        case GhostController.ghostMode.kDead:         // back in ghost box
            x = 13;
            y = 21;
            break;

        case GhostController.ghostMode.kLeavingHouse:         // back in ghost box
            x = 13;
            y = 21;
            break;

        default:         // no target
            x = y = 0;
            break;
        }
    }
Exemple #3
0
    public void GetTarget(out int x, out int y, GhostController.ghostMode currentMode, GameController c)
    {
        // default code that needs to be written
        x = y = 0;
        switch (currentMode)
        {
        case GhostController.ghostMode.kChase:
            // Where do you go in chase mode?
            switch (c.pacmanLastMove)
            {
            case GameController.direction.kLeft:
                x = (c.pacmanLoc.x - 4) / 8;
                y = c.pacmanLoc.y / 8;
                break;

            case GameController.direction.kRight:
                x = (c.pacmanLoc.x + 4) / 8;
                y = c.pacmanLoc.y / 8;
                break;

            case GameController.direction.kUp:
                x = c.pacmanLoc.x / 8;
                y = (c.pacmanLoc.y + 4) / 8;
                break;

            case GameController.direction.kDown:
                x = c.pacmanLoc.x / 8;
                y = (c.pacmanLoc.y + 4) / 8;
                break;

            default:
                x = 0;
                y = 288 / 8;
                break;
            }
            break;

        case GhostController.ghostMode.kScatter:
            // Where do you go in scatter mode?
            x = 0;
            y = 288 / 8;
            break;

        case GhostController.ghostMode.kDead:         // back in ghost box
            // Moves to top of ghost box before regenerating
            x = 13;
            y = 21;
            break;

        case GhostController.ghostMode.kLeavingHouse:         // back in ghost box
            // Moves to top of ghost box before starting regular behavior
            x = 13;
            y = 21;
            break;

        default:         // no target
            x = y = 0;
            break;
        }
    }
Exemple #4
0
    public void GetTarget(out int x, out int y, GhostController.ghostMode currentMode, GameController c)
    {
        switch (currentMode)
        {
        case GhostController.ghostMode.kChase:
            y = c.pacmanLoc.y / 8;
            x = c.pacmanLoc.x / 8;
            if (c.pacmanLastMove == GameController.direction.kUp)
            {
                y += 2;
            }
            if (c.pacmanLastMove == GameController.direction.kDown)
            {
                y -= 2;
            }
            if (c.pacmanLastMove == GameController.direction.kLeft)
            {
                x -= 2;
            }
            if (c.pacmanLastMove == GameController.direction.kRight)
            {
                x += 2;
            }
            x += 2 * (c.blinkyLoc.x - x);
            y += 2 * (c.blinkyLoc.y - y);
            break;

        case GhostController.ghostMode.kScatter:
            y = 0;
            x = GameMaze.boardWidth - 2;
            break;

        case GhostController.ghostMode.kDead:         // back in ghost box
            x = 13;
            y = 21;
            break;

        case GhostController.ghostMode.kLeavingHouse:         // back in ghost box
            x = 13;
            y = 21;
            break;

        default:         // no target
            x = y = 0;
            break;
        }
    }
Exemple #5
0
    public void GetTarget(out int x, out int y, GhostController.ghostMode currentMode, GameController c)
    {
        // default code that needs to be written
        x = y = 0;
        switch (currentMode)
        {
        case GhostController.ghostMode.kChase:
            // Where do you go in chase mode?
            if (GhostController.Dist(c.clydeLoc.x / 8, c.clydeLoc.y / 8,
                                     c.pacmanLoc.x / 8, c.pacmanLoc.y / 8) < 8)
            {
                x = c.pacmanLoc.x / 8;
                y = c.pacmanLoc.y / 8;
            }
            else
            {
                x = 0;
                y = 0;
            }
            break;

        case GhostController.ghostMode.kScatter:
            x = 0;
            y = 0;
            // Where do you go in scatter mode?
            break;

        case GhostController.ghostMode.kDead:         // back in ghost box
            // Moves to top of ghost box before regenerating
            x = 13;
            y = 21;
            break;

        case GhostController.ghostMode.kLeavingHouse:         // back in ghost box
            // Moves to top of ghost box before starting regular behavior
            x = 13;
            y = 21;
            break;

        default:         // no target
            x = y = 0;
            break;
        }
    }
Exemple #6
0
    public void GetTarget(out int x, out int y, GhostController.ghostMode currentMode, GameController c)
    {
        // default code that needs to be written
        x = y = 0;
        switch (currentMode)
        {
        case GhostController.ghostMode.kChase:
            // Where do you go in chase mode?
            //Vector2 offset = new Vector2 (c.inkyLoc.x, c.inkyLoc.y) - new Vector2 (c.pacmanLoc.x, c.pacmanLoc.y);
            xyLoc offset = new xyLoc(c.blinkyLoc.x - c.pacmanLoc.x, c.blinkyLoc.y - c.pacmanLoc.y);
            int   xOff   = 0;
            int   yOff   = 0;
            switch (c.pacmanLastMove)
            {
            case GameController.direction.kLeft:
                xOff = c.pacmanLoc.x - 2;
                yOff = c.pacmanLoc.y;
                x    = (xOff + offset.x) / 8;
                y    = (yOff + offset.y) / 8;
                break;

            case GameController.direction.kRight:
                xOff = c.pacmanLoc.x + 2;
                yOff = c.pacmanLoc.y;
                x    = (xOff + offset.x) / 8;
                y    = (yOff + offset.y) / 8;
                break;

            case GameController.direction.kUp:
                xOff = c.pacmanLoc.x;
                yOff = c.pacmanLoc.y + 2;
                x    = (xOff + offset.x) / 8;
                y    = (yOff + offset.y) / 8;
                break;

            case GameController.direction.kDown:
                xOff = c.pacmanLoc.x;
                yOff = c.pacmanLoc.y - 2;
                x    = (xOff + offset.x) / 8;
                y    = (yOff + offset.y) / 8;
                break;

            default:
                break;
            }
            break;

        case GhostController.ghostMode.kScatter:
            // Where do you go in scatter mode?
            y = 0;
            x = 244 / 8;
            break;

        case GhostController.ghostMode.kDead:         // back in ghost box
            // Moves to top of ghost box before regenerating
            x = 13;
            y = 21;
            break;

        case GhostController.ghostMode.kLeavingHouse:         // back in ghost box
            // Moves to top of ghost box before starting regular behavior
            x = 13;
            y = 21;
            break;

        default:         // no target
            x = y = 0;
            break;
        }
    }