Files
PacMan/src/main/java/se/urmo/game/util/MyPoint.java
Urban Modig 11a550e997 Implement ghost "eaten" behavior and refine fright mechanics
Added a new "eaten" mode for ghosts, including animations, movement strategy, and logic to reset ghosts after being eaten. Adjusted scoring for frightened ghosts using a fright multiplier and introduced enhancements like streamlined direction prioritization and position alignment. Also temporarily disabled non-essential ghosts for testing purposes.
2025-09-03 12:53:26 +02:00

41 lines
873 B
Java

package se.urmo.game.util;
import java.awt.Point;
public class MyPoint {
public final double x;
public final double y;
public MyPoint(double x, double y) {
this.x = x;
this.y = y;
}
public Point asPoint() {
return new Point((int) x, (int) y);
}
@Override
public String toString() {
return "MyPoint{" +
"x=" + x +
", y=" + y +
'}';
}
@Override
public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) return false;
MyPoint myPoint = (MyPoint) o;
return Double.compare(x, myPoint.x) == 0 && Double.compare(y, myPoint.y) == 0;
}
@Override
public int hashCode() {
int result = Double.hashCode(x);
result = 31 * result + Double.hashCode(y);
return result;
}
}