Ejemplo n.º 1
0
        //only accessable from within the Ghost AI class.(I think)
        public static void find_target(Ghost_AI.AI_STATE ai_state)
        {
            switch (ai_state)
            {
            case Ghost_AI.AI_STATE.SCATTER:
                target_x = 1;
                target_y = 35;
                break;

            case Ghost_AI.AI_STATE.CHASE:
                if (Ghost_AI.check_distance(x, y, Player.x, Player.y, direction) <= 8)
                //if (Math.Abs(Player.x - Clyde.x) <= 8 || Math.Abs(Player.y - Clyde.y) <= 8)
                {
                    target_x = 0;
                    target_y = 35;
                }
                else
                {
                    if (Player.direction == 0)
                    {
                        target_x = Player.x;
                        target_y = Player.y;
                    }
                    else if (Player.direction == 1)
                    {
                        target_x = Player.x;
                        target_y = Player.y;
                    }
                    else if (Player.direction == 2)
                    {
                        target_x = Player.x;
                        target_y = Player.y;
                    }
                    else if (Player.direction == 3)
                    {
                        target_x = Player.x;
                        target_y = Player.y;
                    }
                }
                break;

            case Ghost_AI.AI_STATE.FRIGHTENED:
                break;
            }
        }
Ejemplo n.º 2
0
        //only accessable from within the Ghost AI class.(I think)
        public static void find_target(Ghost_AI.AI_STATE ai_state)
        {
            switch (ai_state)
            {
            case Ghost_AI.AI_STATE.SCATTER:
                target_x = 25;
                target_y = 0;
                break;

            case Ghost_AI.AI_STATE.CHASE:
                target_x = Player.x;
                target_y = Player.y;
                break;

            case Ghost_AI.AI_STATE.FRIGHTENED:
                break;
            }
        }
Ejemplo n.º 3
0
        //only accessable from within the Ghost AI class.(I think)
        public static void find_target(Ghost_AI.AI_STATE ai_state)
        {
            switch (ai_state)
            {
            case Ghost_AI.AI_STATE.SCATTER:
                target_x = 2;
                target_y = 0;
                break;

            case Ghost_AI.AI_STATE.CHASE:
                if (Player.direction == 0)
                {
                    target_x = Player.x - 4;
                    target_y = Player.y;
                }
                else if (Player.direction == 1)
                {
                    target_x = Player.x;
                    target_y = Player.y - 4;
                }
                else if (Player.direction == 2)
                {
                    target_x = Player.x + 4;
                    target_y = Player.y;
                }
                else if (Player.direction == 3)
                {
                    target_x = Player.x;
                    target_y = Player.y + 4;
                }
                break;

            case Ghost_AI.AI_STATE.FRIGHTENED:
                break;
            }
        }
Ejemplo n.º 4
0
        //only accessable from within the Ghost AI class.(I think)
        public static void find_target(Ghost_AI.AI_STATE ai_state)
        {
            switch (ai_state)
            {
            case Ghost_AI.AI_STATE.SCATTER:
                target_x = 27;
                target_y = 35;
                break;

            case Ghost_AI.AI_STATE.CHASE:
                if (Player.direction == 0)
                {
                    target_x = Player.x - 2;
                    target_y = Player.y;
                    int xvar = Math.Abs(Blinky.x - target_x);
                    int yvar = Math.Abs(Blinky.y - target_y);
                    if (Blinky.x < Player.x)
                    {
                        target_x += xvar;
                    }
                    else if (Blinky.x > Player.x)
                    {
                        target_x -= xvar;
                    }

                    if (Blinky.y < Player.y)
                    {
                        target_y += yvar;
                    }
                    else if (Blinky.y > Player.y)
                    {
                        target_y -= yvar;
                    }
                }
                else if (Player.direction == 1)
                {
                    target_x = Player.x;
                    target_y = Player.y - 2;
                    int xvar = Math.Abs(Blinky.x - target_x);
                    int yvar = Math.Abs(Blinky.y - target_y);
                    if (Blinky.x < Player.x)
                    {
                        target_x += xvar;
                    }
                    else if (Blinky.x > Player.x)
                    {
                        target_x -= xvar;
                    }

                    if (Blinky.y < Player.y)
                    {
                        target_y += yvar;
                    }
                    else if (Blinky.y > Player.y)
                    {
                        target_y -= yvar;
                    }
                }
                else if (Player.direction == 2)
                {
                    target_x = Player.x + 2;
                    target_y = Player.y;
                    int xvar = Math.Abs(Blinky.x - target_x);
                    int yvar = Math.Abs(Blinky.y - target_y);
                    if (Blinky.x < Player.x)
                    {
                        target_x += xvar;
                    }
                    else if (Blinky.x > Player.x)
                    {
                        target_x -= xvar;
                    }

                    if (Blinky.y < Player.y)
                    {
                        target_y += yvar;
                    }
                    else if (Blinky.y > Player.y)
                    {
                        target_y -= yvar;
                    }
                }
                else if (Player.direction == 3)
                {
                    target_x = Player.x;
                    target_y = Player.y + 2;
                    int xvar = Math.Abs(Blinky.x - target_x);
                    int yvar = Math.Abs(Blinky.y - target_y);
                    if (Blinky.x < Player.x)
                    {
                        target_x += xvar;
                    }
                    else if (Blinky.x > Player.x)
                    {
                        target_x -= xvar;
                    }

                    if (Blinky.y < Player.y)
                    {
                        target_y += yvar;
                    }
                    else if (Blinky.y > Player.y)
                    {
                        target_y -= yvar;
                    }
                }

                break;

            case Ghost_AI.AI_STATE.FRIGHTENED:
                break;
            }
        }