So im making a tile based game but the colision detection with the tiles doenst work right(the collision rect goes thru the corners of the blocked tile). although i know why it doesnt work , i cant think of a way around it. here is the method where the problem is at:
//moves the sprite, acording to the velx, vely, if it is possible to do so
//this method moves sprites using the hitsquare collision method with the map tiles
//calls the sprites mapCollision() method if it collides with a blocked tile
public void moveSquareSprite(Sprite s){
int sl = s.getHitSquareLength();
int newx = (int) (s.getPosX()+s.getVelX());
int newy = (int) (s.getPosY()+s.getVelY());
//calc row/col of tiles that each side is on...
int top = (newy-(sl/2)) / tileHeight ;
int bottom = (newy+(sl/2)) / tileHeight ;
int left = (newx-(sl/2)) / tileWidth ;
int right = (newx+(sl/2)) / tileWidth ;
boolean topleft = tiles[left][top].blocked;
boolean bottomleft = tiles[left][bottom].blocked;
boolean topright = tiles[right][top].blocked;
boolean bottomright = tiles[right][bottom].blocked;
boolean collided = false;
//test if moving upward
if(s.getVelY() < 0){
if(topright && topleft){
s.setPosY( (tileHeight*(top+1)) + (sl/2));
s.setVelY(0);
collided=true;
}else{
s.setPosY( s.getPosY()+s.getVelY() );
}
}
//test for moving downward
else if(s.getVelY() > 0){
if(bottomright && bottomleft){
s.setPosY( tileHeight*bottom - (sl/2));
s.setVelY(0);
collided=true;
}else{
s.setPosY( s.getPosY()+s.getVelY() );
}
}
//test for moving left
if(s.getVelX() < 0){
if(topleft && bottomleft){
s.setPosX( (tileWidth*(left+1)) + (sl/2));
s.setVelX(0);
collided=true;
}else{
s.setPosX( s.getPosX()+s.getVelX() );
}
}
//test for moving right
else if(s.getVelX() > 0){
if(bottomright && topright){
s.setPosX( tileWidth*right - (sl/2));
s.setVelX(0);
collided=true;
}else{
s.setPosX( s.getPosX()+s.getVelX() );
}
}
if(collided)
s.mapCollision();
}
I have attached the whole game in a zip file renamed to a *.txt file if you want to look at it.
thanks, please help me 
PS.in the renamed zip file is also the server for my game, if you want you could look at that and inform me if it is efficent or not?
if you know you are only moving between these locations you can make collision really simple (in the way jeff mentioned). Just check if the next tile is empty before making the transition from one to the next, and don’t do any detection at all during the transition (you already know the character is moving to a safe location at that point).