Mascara de colisão rectangle

galera to tentando fazer com que a mascara “rectangle” do meu player colida com as paredes, ai criei um metodo de teste "playColideComParede(); na classe do player, mas nao ta funcionando o q ta colidindo com a parede e o tile do player q tem tamanho 64,64, e nao a mascara q tem tamanho menor o q tenho q alterar no código acho q tem algo haver com o que esta na classe world?

public class Player extends Entity {

	public boolean right, up, left, down;
	public int right_dir = 0, up_dir = 1, left_dir = 3, down_dir = 4;
	public int dir = down_dir;
	public double speed = 3.0;
	private int frames = 0, maxFrame = 7, index = 1, maxIndex = 2;
	private boolean muved = false;
	public double vidaPlayer = 100, vidaMaxima = 100;
	public static int municao = 0;
	public boolean tomandoDano = false;
	private int danoFrames = 0;
	public boolean temArma = false;
	public boolean atirando = false;
	
	public int mascaraX = 25, mascaraY = 5, mascaraW = 16, mascaraH = 60;

	private BufferedImage[] right_Player;
	private BufferedImage[] left_Player;
	private BufferedImage[] up_Player;
	private BufferedImage[] down_Player;

	private BufferedImage[] right_PlayerDano;
	private BufferedImage[] left_PlayerDano;
	private BufferedImage[] up_PlayerDano;
	private BufferedImage[] down_PlayerDano;

	public Player(int x, int y, int widtht, int height, BufferedImage sprite) {
		super(x, y, widtht, height, sprite);

		this.right_Player = new BufferedImage[3];
		this.left_Player = new BufferedImage[3];
		this.up_Player = new BufferedImage[3];
		this.down_Player = new BufferedImage[3];

		for (int i = 0; i < 3; i++) {
			this.right_Player[i] = Game.spriteSheet.getSprite(0 + (i * 64), 128, 64, 64);
			this.left_Player[i] = Game.spriteSheet.getSprite(0 + (i * 64), 64, 64, 64);
			this.up_Player[i] = Game.spriteSheet.getSprite(0 + (i * 64), 192, 64, 64);
			this.down_Player[i] = Game.spriteSheet.getSprite(0 + (i * 64), 0, 64, 64);
		}
		// Player toma dano
		this.right_PlayerDano = new BufferedImage[3];
		this.left_PlayerDano = new BufferedImage[3];
		this.up_PlayerDano = new BufferedImage[3];
		this.down_PlayerDano = new BufferedImage[3];

		for (int i = 0; i < 3; i++) {
			this.right_PlayerDano[i] = Game.spriteSheet.getSprite(0 + (i * 64), 64 * 6, 64, 64);
			this.left_PlayerDano[i] = Game.spriteSheet.getSprite(0 + (i * 64), 64 * 5, 64, 64);
			this.up_PlayerDano[i] = Game.spriteSheet.getSprite(0 + (i * 64), 64 * 7, 64, 64);
			this.down_PlayerDano[i] = Game.spriteSheet.getSprite(0 + (i * 64), 64 * 4, 64, 64);
		}

	}

	public void tick() {
		muved = false;
		// se precisonasr right
		if (right && World.caminhoLivre((int) (x + speed), this.getY())) {
			muved = true;
			dir = right_dir;
			x += speed;
			// System.out.println("valor"+x);
		} else if (left && World.caminhoLivre((int) (x - speed), this.getY())) {
			muved = true;
			dir = left_dir;
			x -= speed;
		} else if (up && World.caminhoLivre(this.getX(), (int) (y - speed))) {
			muved = true;
			dir = up_dir;
			y -= speed;
		} else if (down && World.caminhoLivre(this.getX(), (int) (y + speed))) {
			muved = true;
			dir = down_dir;
			y += speed;
		}
		//
		if (muved) {
			frames++;
			if (frames == maxFrame) {
				frames = 0;
				index++;
				if (index > maxIndex) {
					index = 0;
				}
			}
		}
		checarColisao_PVida();
		checarColisao_Arma();
		checarColisao_Municao();
		playColideComParede();

		if (tomandoDano) {
			danoFrames++;
			if (danoFrames == 8) {
				danoFrames = 0;
				tomandoDano = false;
			}
		}
// 
		if(atirando && temArma && municao>0) {
			atirando = false;
			int dx =0;
			int dy =0;
			if(dir==this.right_dir) {
				dx =1;
				Tiros tiros = new Tiros(this.getX()+70, this.getY()+5,10,10,null,dx,dy);
				tiros.muved_Tiros = true; 
				tiros.dir_Tiros=tiros.right_dir_Tiros;
				Game.tiros.add(tiros);
				municao-=1;
			}
			else	if(dir==this.left_dir) {
				dx =-1;
				Tiros tiros = new Tiros(this.getX()-70, this.getY()+5,10,10,null,dx,dy);
				tiros.muved_Tiros = true; 
				tiros.dir_Tiros=tiros.left_dir_Tiros;
				Game.tiros.add(tiros);
				municao-=1;
			}
			else	if(dir==this.up_dir) {
				dy =-1;
				Tiros tiros = new Tiros(this.getX()+15, this.getY()-30,10,10,null,dx,dy);
				tiros.muved_Tiros = true; 
				tiros.dir_Tiros=tiros.up_dir_Tiros;
				Game.tiros.add(tiros);
				municao-=1;
			}
			else	if(dir==this.down_dir) {
				dy =1;
				Tiros tiros = new Tiros(this.getX()-15, this.getY()+45,10,10,null,dx,dy);
				tiros.muved_Tiros = true; 
				tiros.dir_Tiros=tiros.down_dir_Tiros;
				Game.tiros.add(tiros);
				municao-=1;
			}
		}
		
		if (this.vidaPlayer <= 0) {
			Game.entities = new ArrayList<Entity>();
			Game.inimigosLista = new ArrayList<Inimigos>();
			Game.spriteSheet = new SpreteSheet("/sprites.png");
			Game.player = new Player(0, 0, 64, 64, Game.spriteSheet.getSprite(0, 0, 64, 64));
			Game.entities.add(Game.player);
			Game.world = new World("/MiniMapa.png");
			return;
		}
		

		Camera.x = Camera.clamp(this.getX() - (Game.WIDTH / 2), 0, World.WIDTH * 64 - Game.WIDTH);
		Camera.y = Camera.clamp(this.getY() - (Game.HEIGHT / 2), 0, World.HEIGHT * 64 - Game.HEIGHT);

	}

	
	private void checarColisao_Municao() {
		// TODO Auto-generated method stub
		
	}

	public boolean playColideComParede() {

		Rectangle mascaraDoPlayer = new Rectangle(this.getX()+ mascaraX, this.getY()+ mascaraY, mascaraW, mascaraH);
		Rectangle parde = new Rectangle(TileParede.Tile_parede.getWidth(), TileParede.Tile_parede.getHeight(), 64, 64);
		
		
		return mascaraDoPlayer.intersects(parde);
	}
	
	public void checarColisao_Arma() {

		for (int i = 0; i < Game.entities.size(); i++) {

			Entity atual = Game.entities.get(i);
			if (atual instanceof Arma) {
				if (Entity.estaColidindo(this, atual)) {
					temArma =true;
					Game.entities.remove(atual);
				}
			}
		}
	}
	public void checarColisao_Municao1() {

		for (int i = 0; i < Game.entities.size(); i++) {

			Entity atual = Game.entities.get(i);
			if (atual instanceof Municao) {
				if (Entity.estaColidindo(this, atual)) {
					municao += 200;
				//	System.out.println("Municao " + municao);
					Game.entities.remove(atual);
				}
			}
		}
	}

	public void checarColisao_PVida() {

		for (int i = 0; i < Game.entities.size(); i++) {

			Entity atual = Game.entities.get(i);
			if (atual instanceof Potion) {
				if (Entity.estaColidindo(this, atual)) {
					vidaPlayer += 20;
					if (vidaPlayer > vidaMaxima)
						vidaPlayer = vidaMaxima;
					Game.entities.remove(atual);
				}
			}
		}
	}


	public void render(Graphics g) {
		
		
		if (!this.tomandoDano) {
			if (dir == right_dir) {
				g.drawImage(right_Player[index], this.getX() - Camera.x, this.getY() - Camera.y, null);
				if(this.temArma) {
					// desenha arma para direita.
					g.drawImage(Entity.Arma_V_direita,this.getX()+30- Camera.x, this.getY()+10 - Camera.y , null);
				}
					
			} else if (dir == left_dir) {
				g.drawImage(left_Player[index], this.getX() - Camera.x, this.getY() - Camera.y, null);
				if(this.temArma) {
					// desenha arma para esquerda.
					g.drawImage(Entity.Arma_V_esquerda,this.getX()-30- Camera.x, this.getY()+10 - Camera.y , null);
				}
			} else if (dir == up_dir) {
				g.drawImage(up_Player[index], this.getX() - Camera.x, this.getY() - Camera.y, null);
				if(this.temArma) {
					// desenha arma para cima.
					g.drawImage(Entity.Arma_V_cima,this.getX()-5- Camera.x, this.getY() - Camera.y , null);
				}
			} else if (dir == down_dir) {
				g.drawImage(down_Player[index], this.getX() - Camera.x, this.getY() - Camera.y, null);
				if(this.temArma) {
					// desenha arma para baixo.
					g.drawImage(Entity.Arma_V_baixo,this.getX()-5- Camera.x, this.getY() - Camera.y , null);
				}
			}
		} else {
			if (dir == right_dir) {
				g.drawImage(right_PlayerDano[index], this.getX() - Camera.x, this.getY() - Camera.y, null);
			} else if (dir == left_dir) {
				g.drawImage(left_PlayerDano[index], this.getX() - Camera.x, this.getY() - Camera.y, null);
			} else if (dir == up_dir) {
				g.drawImage(up_PlayerDano[index], this.getX() - Camera.x, this.getY() - Camera.y, null);
			} else if (dir == down_dir) {
				g.drawImage(down_PlayerDano[index], this.getX() - Camera.x, this.getY() - Camera.y, null);
			}
		}
		g.setColor(Color.YELLOW);
		g.fillRect(this.getX()+mascaraX-Camera.x, this.getY()+mascaraY-Camera.y, mascaraW, mascaraH);
		
	}
	
}
public class World {

	private static Tile[] tiles;
	public static int WIDTH, HEIGHT;
	public static final int TILE_size=64;


	public World(String path) {

		try {
			BufferedImage miniMapa = ImageIO.read(getClass().getResource(path));
			int[] pixels = new int[miniMapa.getWidth() * miniMapa.getHeight()];

			WIDTH = miniMapa.getWidth();
			HEIGHT = miniMapa.getHeight();

			tiles = new Tile[miniMapa.getWidth() * miniMapa.getHeight()];

			miniMapa.getRGB(0, 0, miniMapa.getWidth(), miniMapa.getHeight(), pixels, 0, miniMapa.getWidth());

			for (int xx = 0; xx < miniMapa.getWidth(); xx++) {
				for (int yy = 0; yy < miniMapa.getHeight(); yy++) {

					int pixelAtual = pixels[xx +(yy * miniMapa.getWidth())];
					
					tiles[xx + (yy * this.WIDTH)]= new TileChao(xx*64,yy*64,Tile.Tile_chao);
				
					// Ch�o!
					if (pixelAtual == 0xff070000) {

						tiles[xx+(yy*this.WIDTH)] = new TileChao(xx*64,yy*64,Tile.Tile_chao);
						
					}
					// Parede!
					else if (pixelAtual == 0xffffffff) {
				
						tiles[xx+(yy*this.WIDTH)] = new TileParede(xx*64,yy*64,Tile.Tile_parede);
						
					} 
					// Player!
					else if (pixelAtual == 0xff0c3ee6) {
						
					Game.player.setX(xx*64);
					Game.player.setY(yy*64);
				
						
					}
					// Arma!
					else if (pixelAtual == 0xff74685a) {
						
					Game.entities.add(new Arma(xx*64,yy*64,64,64,Entity.Arma));
						
					}
					// Muni��i!
					else if (pixelAtual == 0xfffeee00) {
						
						Game.entities.add(new Municao(xx*64,yy*64,64,64,Entity.Municao));
						
					}
					// Vida!!
					else if (pixelAtual == 0xff00ff00) {
						
						Game.entities.add(new Potion(xx*64,yy*64,64,64,Entity.Potion_Vida));
					}
					// Inimigo_1!
					else if (pixelAtual == 0xffe90505) {
						
						Inimigos IN = new Inimigos(xx*64,yy*64,64,64,Entity.Inimigo_1);
						Game.entities.add(IN);
						Game.inimigosLista.add(IN);
					}
					
					// Ch�o!
					if (pixelAtual == 0xff070000) {

						tiles[xx+(yy*this.WIDTH)] = new TileChao(xx*64,yy*64,Tile.Tile_chao);
						
					}

				}
			}

		} catch (IOException e) {

			e.printStackTrace();
		}

	}
	
	public static boolean caminhoLivre(int xNext, int yNext) {
		
		int x1 = xNext / TILE_size;
		int y1 = yNext / TILE_size;
		
		int x2 = (xNext + TILE_size-1) / TILE_size;
		int y2 = yNext  / TILE_size;
		
		int x3 =  xNext / TILE_size;
		int y3 = (yNext  + TILE_size-1)/TILE_size;
		
		int x4 =  (xNext  + TILE_size-1)/TILE_size;
		int y4 = (yNext  + TILE_size-1)/TILE_size;
		
		
		return !(tiles[x1+(y1*World.WIDTH)]instanceof TileParede
				|| tiles[x2+(y2*World.WIDTH)]instanceof TileParede
				|| tiles[x3+(y3*World.WIDTH)]instanceof TileParede
				|| tiles[x4+(y4*World.WIDTH)]instanceof TileParede);
		
	}

	public void render(Graphics g) {

		int xstart = Camera.x >>6;
		int ystart = Camera.y >>6;
		
		int xfinal = xstart+(Game.WIDTH >>6)+1;
		int yfinal = ystart+(Game.HEIGHT >>6);
		
		for (int xx = xstart; xx <=xfinal; xx++) {
			for (int yy = ystart; yy <= yfinal; yy++) {
				
				if(xx<0 || yy< 0 || xx>= WIDTH || yy >= HEIGHT) 
					continue;		
				Tile tile = tiles[xx+(yy*WIDTH)];
				tile.render(g);
			}
		}

	}

}