Example #1
0
 //level 3 = hard, AI player gets in turns medium or very hard targets
 public Vector2 hardTarget(Player player)
 {
     if (hardIsUsingMedium)
         {
         return mediumTarget();
         }
     else
         {
         return nearestPill(player.getPosition(""));
         }
 }
Example #2
0
        public void moveUpAndRight(Player otherPlayer)
        {
            towardsOneWay = false;

            if (topEdges() || position.Intersects(otherPlayer.getPosition("bottom")))
                {
                bounceFromUpAndRight(false);
                }
            else if (rightEdges() || position.Intersects(otherPlayer.getPosition("left")))
                {
                bounceFromUpAndRight(true);
                }
            else
                {
                up();
                right();
                }
        }
Example #3
0
        public void moveUp(Player otherPlayer)
        {
            towardsOneWay = true;

            if (topEdges() || position.Intersects(otherPlayer.getPosition("bottom")))
                {
                bounceDown();
                }
            else
                {
                up();
                }
        }
Example #4
0
        public void moveRight(Player otherPlayer)
        {
            towardsOneWay = true;

            if (rightEdges() || position.Intersects(otherPlayer.getPosition("left")))
                {
                bounceLeft();
                }
            else
                {
                right();
                }
        }
Example #5
0
        public void moveDownAndRight(Player otherPlayer)
        {
            towardsOneWay = false;

            if (bottomEdges() || position.Intersects(otherPlayer.getPosition("top")))
                {
                bounceFromDownAndRight(false);
                }
            else if (rightEdges() || position.Intersects(otherPlayer.getPosition("left")))
                {
                bounceFromDownAndRight(true);
                }
            else
                {
                down();
                right();
                }
        }
Example #6
0
 //level 4 = very hard, AI player gets always the location of the nearest pill and tries to go towards it
 public Vector2 veryHardTarget(Player player)
 {
     targetAcquired = false;
     return nearestPill(player.getPosition(""));
 }
Example #7
0
        //checks if player hits a moving wall while player is moving only towards one way
        public void checkPlayerHits(Player player1, Player player2)
        {
            if (player1.movingOnlyTowardsOneWay())
                {

                if (player1.getPosition("").Intersects(getPosition("top")))
                    {
                    player1.changeDirectionY(float.MinValue);
                    }

                else if (player1.getPosition("").Intersects(getPosition("bottom")))
                    {
                    player1.changeDirectionY(float.MaxValue);
                    }

                else if (player1.getPosition("").Intersects(getPosition("left")))
                    {
                    player1.changeDirectionX(float.MinValue);
                    }

                else if (player1.getPosition("").Intersects(getPosition("right")))
                    {
                    player1.changeDirectionX(float.MaxValue);
                    }

                }

            if (player2.movingOnlyTowardsOneWay())
                {

                if (player2.getPosition("").Intersects(getPosition("top")))
                    {
                    player2.changeDirectionY(float.MinValue);
                    }

                else if (player2.getPosition("").Intersects(getPosition("bottom")))
                    {
                    player2.changeDirectionY(float.MaxValue);
                    }

                else if (player2.getPosition("").Intersects(getPosition("left")))
                    {
                    player2.changeDirectionX(float.MinValue);
                    }

                else if (player2.getPosition("").Intersects(getPosition("right")))
                    {
                    player2.changeDirectionX(float.MaxValue);
                    }

                }
        }