Ejemplo n.º 1
0
 public void CollisionEffect(SnakeBody sb)
 {
     if (sb.mySnake != this.mySnake)
     {
         this.mySnake.addScore(5);
     }
     sb.mySnake.isAlive = false;
 }
Ejemplo n.º 2
0
 //Checks the snake head against the collision matrix to see if it is colliding with anything and then adds is
 public void SnakeHeadCollisions(SnakeBody snakeHead)
 {
     if (SnakeOutOfBounds(snakeHead))
     {
         snakeHead.mySnake.isAlive = false;
     }
     else if (collidables[snakeHead.position.X, snakeHead.position.Y] != null)
     {
         collidables[snakeHead.position.X, snakeHead.position.Y].CollisionEffect(snakeHead);
     }
 }
Ejemplo n.º 3
0
        //Checks that the snake is not out of bounds
        public bool SnakeOutOfBounds(SnakeBody snakeHead)
        {
            if (snakeHead.position.X < 0 || snakeHead.position.X >= XSize)
            {
                return(true);
            }

            if (snakeHead.position.Y < 0 || snakeHead.position.Y >= YSize)
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 4
0
 public override void CollisionEffect(SnakeBody sb)
 {
     base.CollisionEffect(sb);
     playField.GiveRandomSnakeSpeedUpEffect();
     AmountOfSpeedyFood--;
 }
Ejemplo n.º 5
0
 public override void CollisionEffect(SnakeBody sb)
 {
     base.CollisionEffect(sb);
     AmountOfStandardFood--;
 }
Ejemplo n.º 6
0
 public override void CollisionEffect(SnakeBody sb)
 {
     base.CollisionEffect(sb);
     AmountOfValuableFood--;
 }
Ejemplo n.º 7
0
 public void MoveTo(SnakeBody sb)
 {
     this.position = sb.position;
 }