//TODO protected override void UpdateTarget(Pacboi pacman, Ghost blinky, Board board) { int xFrontPac = pacman.rec.X / 24; int yFrontPac = pacman.rec.Y / 24; Vector2 pacV = pacman.velocities; if (pacV.X > 0) { xFrontPac += 2; } if (pacV.X < 0) { xFrontPac -= 2; } if (pacV.Y > 0) { yFrontPac += 2; } if (pacV.Y < 0) { yFrontPac -= 2; } int xBlinkyDistFrontPac = xFrontPac - blinky.getRect().X / 24; int yBlinkyDistFrontPac = yFrontPac - blinky.getRect().Y / 24; targetSquareLoc.X = xFrontPac - xBlinkyDistFrontPac; targetSquareLoc.Y = yFrontPac - yBlinkyDistFrontPac; UpdateDirection(board); }
protected override void UpdateTarget(Pacboi pacman, Ghost blinky, Board board) { int distFrontPac = 4; int squareX = pacman.rec.X / 24; int squareY = pacman.rec.Y / 24; Vector2 pacV = pacman.velocities; if (pacV.X > 0) { squareX += distFrontPac; } if (pacV.X < 0) { squareX -= distFrontPac; } if (pacV.Y > 0) { squareY += distFrontPac; } if (pacV.Y < 0) { squareY -= distFrontPac; } targetSquareLoc.X = squareX; targetSquareLoc.Y = squareY; UpdateDirection(board); }
protected override void UpdateTarget(Pacboi pacman, Ghost Blinky, Board board) { if (!scatter) { targetSquareLoc.X = pacman.rec.X / 24; targetSquareLoc.Y = pacman.rec.Y / 24; } UpdateDirection(board); }
protected override void UpdateTarget(Pacboi pacman, Ghost blinky, Board board) { int squareX = (int)(pacman.rec.X) / 24; int squareY = (int)(pacman.rec.Y) / 24; double xDistFromPac = squareX - getSquareX(); double yDistFromPac = squareY - getSquareY(); double distFromPac = Math.Sqrt(xDistFromPac * xDistFromPac + yDistFromPac * yDistFromPac); if (distFromPac <= 8) { Scatter(); } else { targetSquareLoc.X = squareX; targetSquareLoc.Y = squareY; } UpdateDirection(board); }
public void Update(Pacboi pacman, Ghost blinky, Board board) { counter++; animateCounter++; x += velocity.X; y += velocity.Y; if (x + rect.Width < 0) { x += board.screenSize.Width; } if (x > board.screenSize.Width) { x -= board.screenSize.Width; } rect.X = (int)x; rect.Y = (int)y; //centerRect.X = (int)x; //centerRect.Y = (int)y; //if (scatter) //{ // CheckScatter(); //} //else if (counter == 6) { counter = 0; if (scatter) { UpdateDirection(board); } else { UpdateTarget(pacman, blinky, board); } } sourceRect.X = 4; if (animateCounter < 8) { //First one } else { //second one sourceRect.X += 16; } if (dir == Direction.Left) { sourceRect.X += 32; } if (dir == Direction.Up) { sourceRect.X += 64; } if (dir == Direction.Down) { sourceRect.X += 96; } if (animateCounter == 16) { animateCounter = 0; } }
protected virtual void UpdateTarget(Pacboi pacman, Ghost blinky, Board board) { }