public int getHeight(int x, int y) { if (x >= 0 && x < map.getWidth() && y >= 0 && y < map.getHeight()) { return map.getHeightAt(x, y); } else { return 0; } }
int dheight = map.getHeightAt(centerX, mapMinY) - map.getHeightAt(centerX, Math.min(mapMinY + mapLineHeight, mapHeight - 1)); basecolor *= 1 + .15f * dheight;
/** * @param screenX * The x coordinate in draw space * @param screenY * The y coordinate in draw space. * @return The map position under the point. */ private ShortPoint2D getPositionUnder(float screenX, float screenY) { // do a three step iteration by using the coordinate transformation and the map height int mapX = getConverter().getMapX(screenX, screenY); int mapY = getConverter().getMapY(screenX, screenY); if (mapX < 0 || map.getWidth() <= mapX || mapY < 0 || map.getHeight() <= mapY) { return new ShortPoint2D(mapX, mapY); } float height = map.getHeightAt(mapX, mapY); mapX = (int) (getConverter().getExactMapXwithHeight(screenX, screenY, height) + 0.5); mapY = (int) (getConverter().getExactMapYwithHeight(screenX, screenY, height) + 0.5); height = map.getHeightAt(mapX, mapY); mapX = (int) (getConverter().getExactMapXwithHeight(screenX, screenY, height) + 0.5); mapY = (int) (getConverter().getExactMapYwithHeight(screenX, screenY, height) + 0.5); return new ShortPoint2D(mapX, mapY); }
return; float height = context.getMap().getHeightAt(x, y); EDirection direction = ship.getDirection(); EDirection shipImageDirection = direction.rotateRight(3); // ship images have a different direction numbering