Ghost movement working - first rev

This commit is contained in:
Urban Modig
2025-08-17 15:03:54 +02:00
parent 1bbba216d2
commit 05285529c5
10 changed files with 95 additions and 63 deletions

View File

@ -1,7 +1,12 @@
package se.urmo.game.map;
import lombok.Getter;
import lombok.Setter;
import java.awt.image.BufferedImage;
@Getter
@Setter
public class MapTile {
private final int value;
private BufferedImage image;
@ -11,14 +16,10 @@ public class MapTile {
public MapTile(BufferedImage image, int value) {
this.value = value;
this.image = image;
this.solid = value != 0;
this.solid = value != 0 && value != 99;
this.collisionMask = value != 0 ? createCollisionMask(image) : null;
}
public boolean[][] getCollisionMask() {
return collisionMask;
}
private boolean[][] createCollisionMask(BufferedImage img) {
if(img == null) return null;
int w = img.getWidth();
@ -33,19 +34,4 @@ public class MapTile {
return mask;
}
public BufferedImage getImage() {
return this.image;
}
public boolean isSolid() {
return this.solid;
}
public void setImage(BufferedImage img) {
this.image = img;
}
public int getValue() {
return this.value;
}
}