Hey guys, first post here, and I got a question!
I made a slick2d game, and used the TilED map editor, and the tiles I want unwalkable I made them a setting where “block = true”, and I can make my game read that, well; heres my code.
I have my sprite drawn in the middle of the screen, and he himself never moves. the map moves when he moves. (this might not be a good way of doing it, but I wanted it to be a scroller map, like you down get to the edge of the screen and have to load another map and it (eg, you got to the bottom of the first map, it loads the second map, and your sprite moves to the top because my map it bigger than the gameframe) right now my sprite is able to move around the whole map without re drawing a different map.
so basically, i guys the maps float x, y is the coordinates will be the players coordinates(if that makes sense.)
public boolean isBlock() {
for (int i = 0; i < grassMap.getWidth(); i++) {
for (int h = 0; h < grassMap.getHeight(); h++) {
int tileID = grassMap.getTileId(i, h, 0);
String v = grassMap.getTileProperty(tileID, "blocked", "false");
if ("true".equals(v)) {
return true;
System.out.println("blocked? x:"+i+" y:"+h);
} else {
return false;
}
}
}
}
blocked = [grassmap.getwidth()][grassmap.getheight()]
the problem is that only returns positive values, but there are parts in the map where the coordinates I want blocked are (ex. -3, -5 )
let me know if I should explain more