1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
//Fonction qui permet d'afficher la map
void Map::afficheMap(Sprite &spriteMur, Sprite &spriteCaisse, Sprite &spriteMario, RenderWindow &fenetre)
{
//Map
map =
{
{0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,MUR},
{0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0},
{0,0,0,MARIO,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,MUR,0,0,0},
{0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,CAISSE},
};
//Parcourt de la map pour afficher les sprites correspondant
for(int i = 0; i < NB_TILE_LARGEUR; i++)
{
for(int j = 0; j < NB_TILE_LONGUEUR; j++)
{
if(map[i][j] == MUR)
{
spriteTexture = spriteMur;
spriteTexture.SetPosition(i * LARGEUR_TILE, j * LONGUEUR_TILE);
fenetre.Draw(spriteTexture);
cout << "i : " << i << "j : " << j << endl;
}/*
else if(map[i][j] == CAISSE)
{
spriteTexture = spriteCaisse;
spriteTexture.SetPosition(i * LARGEUR_TILE, j * LONGUEUR_TILE);
fenetre.Draw(spriteTexture);
cout << "Pasage CAISSE [i][j] [" << i << "][" << j << "]" << endl;
}
else if(map[i][j] == MARIO)
{
spriteTexture = spriteMario;
spriteTexture.SetPosition(i * LARGEUR_TILE, j * LONGUEUR_TILE);
fenetre.Draw(spriteTexture);
cout << "Pasage MARIO [i][j] [" << i << "][" << j << "]" << endl;
}*/
}
}
} |
Partager