Game/Source/Map.cpp
// Method that translates x,y coordinates from map positions to world positions
Method that translates x,y coordinates from map positions to world positions
Method that translates x y coordinates from map positions to world positions
iPoint Map::MapToWorld(int x, int y) const
{
	iPoint ret;
	if (data.type == MAPTYPE_ORTHOGONAL)
	{
		ret.x = x * data.tileWidth;
		ret.y = y * data.tileHeight;
	}
	else if (data.type == MAPTYPE_ISOMETRIC)
	{
		ret.x = (x - y) * (data.tileWidth / 2);
		ret.y = (x + y) * (data.tileHeight / 2);
	}
	else
	{
	LOG("Unknown map type");
	ret.x = x; ret.y = y;
	}
	return ret;
}
iPoint Map :: MapToWorld ( int x , int y ) const { iPoint ret ; if ( data . type == MAPTYPE_ORTHOGONAL ) { ret . x = x * data . tileWidth ; ret . y = y * data . tileHeight ; } else if ( data . type == MAPTYPE_ISOMETRIC ) { ret . x = ( x - y ) * ( data . tileWidth / 2 ) ; ret . y = ( x + y ) * ( data . tileHeight / 2 ) ; } else { LOG ( " " ) ; ret . x = x ; ret . y = y ; } return ret ; }
Method that translates x,y coordinates from map positions to world positions
Method that translates x y coordinates from map positions to world positions
// Add isometric map to world coordinates