Exemplo n.º 1
0
TileManager::TileManager() 
	: m_tiles(NULL)
	, m_x(0)
	, m_y(0)
	, m_updating(false)
	, m_numTypesToRender(0)
	, m_typesToRender(NULL)
{
	TileType* testType = HYDNEW TileType();
	TileType* testType2 = HYDNEW TileType();
	testType->Initialise("C:\\Assets\\01 - Default.xml");
	testType2->Initialise("C:\\Assets\\alt.xml");

	std::pair<int, TileType*> newPair;
	std::pair<int, TileType*> newPair2;

	newPair.first	= 0;
	newPair.second	= testType;

	newPair2.first	= 1;
	newPair2.second	= testType2;

	m_tileTypes.insert(newPair);
	m_tileTypes.insert(newPair2);
		
	m_typesToRender = HYDNEW_ARRAY(TileType*, MAX_TYPES_RENDERED_PER_FRAME);
}
Exemplo n.º 2
0
void Tile::initialiseTypes() {
    types.push_back( TileType( "Air",
                               new sf::Sprite( Resources::getResources().getAirTileTexture() ),
                               false, false, 0 ) );
    types.push_back( TileType( "Surface",
                               new sf::Sprite(Resources::getResources().getSurfaceTileTexture()),
                               false, false, 0 ) );
    types.push_back( TileType( "Dirt",
                               new sf::Sprite( Resources::getResources().getDirtTileTexture() ),
                               true, true, 0 ) );
    types.push_back( TileType( "Gold",
                               new sf::Sprite( Resources::getResources().getGoldTileTexture() ),
                               true, true, 1 ) );
}
Exemplo n.º 3
0
Tile Tile::getTile(short tileCode)
{
	// Utworzenie nowego kafelka, inicjalizacja na podstawie przekazanego kodu
	Tile tile;
	tile.type = TileType(tileCode);
	sf::Texture * txr = new sf::Texture;
	
	// Utworzenie adekwatnego kafelka
	switch (TileType(tileCode))
	{
	case TileType::BLANK:
	{
		ID = 0;
		interaction = NONE;
		collidable = true;
		interactable = false;
		break;
	}
	case TileType::STONE_1:
	{
		ID = 1;
		txr->loadFromFile("Grafiki/stone_1.png");
		tile.sprite.setTexture(*txr);
		interaction = STOP;
		collidable = false;
		interactable = false;
		break;
	}
	case TileType::BRICK_1:
	{
		ID = 3;
		txr->loadFromFile("Grafiki/brick_1.png");
		tile.sprite.setTexture(*txr);
		interaction = STOP;
		collidable = false;
		interactable = false;
		break;
	}
	case TileType::BRICK_2:
	{
		ID = 4;
		txr->loadFromFile("Grafiki/brick_2.png");
		tile.sprite.setTexture(*txr);
		interaction = NONE;
		collidable = false;
		interactable = false;
		break;
	}
	case TileType::LAVA_1:
	{
		ID = 5;
		txr->loadFromFile("Grafiki/lava_1.png");
		tile.sprite.setTexture(*txr);
		interaction = DAMAGE;
		collidable = false;
		interactable = false;
		break;
	}
	case TileType::LAVA_2:
	{
		ID = 6;
		txr->loadFromFile("Grafiki/lava_2.png");
		tile.sprite.setTexture(*txr);
		interaction = DAMAGE;
		collidable = false;
		interactable = false;
		break;
	}
	case TileType::WATER_1:
	{
		ID = 7;
		txr->loadFromFile("Grafiki/water_1.png");
		sprite.setTexture(*txr);
		interaction = NONE;
		collidable = true;
		interactable = false;
		break;
	}
	case TileType::ENTRANCE_DOOR:
	{
		ID = 8;
		txr->loadFromFile("dngn_closed_door");
		tile.sprite.setTexture(*txr);
		interaction = TELEPORT;
		collidable = true;
		interactable = true;
		break;
	}
	case TileType::EXIT_DOOR:
	{
		ID = 9;
		txr->loadFromFile("Grafiki/dngn_altar.png");
		tile.sprite.setTexture(*txr);
		interaction = TELEPORT;
		collidable = true;
		interactable = true;
		break;
	}
	case TileType::PAD_1:
	{
		ID = 10;
		txr->loadFromFile("Grafiki/pad_1.png");
		sprite.setTexture(*txr);
		interaction = NONE;
		collidable = true;
		interactable = false;
		break;
	}
	case TileType::ALTAR_1:
	{
		ID = 11;
		txr->loadFromFile("Grafiki/dngn_altar.png");
		sprite.setTexture(*txr);
		interaction = NONE;
		collidable = true;
		interactable = false;
		break;
	}
	case TileType::MARBLE_1:
	{
		ID = 12;
		tile.texture->loadFromFile("Grafiki/marble_1.png");
		tile.sprite.setTexture(*texture);
		interaction = NONE;
		collidable = false;
		interactable = false;
		break;
	}
	default:
		break;
	}

	return tile;
}
Exemplo n.º 4
0
Tile::Tile(short tileCode, bool _wall) : wall(_wall)
{
	type = TileType(tileCode); /*przypisanie typu w zaleznosci od kodu kafla*/
}