How would I go about retrieving the Halo 5 Medals for my Medal count list?
When I call the Medal API it gives me only one image under EVERY medal, witch is this one:
> https://content.halocdn.com/media/Default/games/halo-5-guardians/sprites/medals_3-16-16-5bc472e359714da28a59aa1bd27e9e2d.png
Is there a way I can get them one by one according to the Medal ID? Or is there a place I can get the Images?
Your best bet is to use CSS Sprites. You auto generate the sprite file via the API response. I wrote them into a CSS file with the class name of the ID of the medal. So it looked like this.
.medal {
width: 74px;
height: 74px;
}
.medal-3786961025 { /* Fastball */
background: url(’/css/images/h5-medals.png’) no-repeat -975px -75px;
}
.medal-1568252876 { /* Wraith Destroyed */
background: url(’/css/images/h5-medals.png’) no-repeat -0px -300px;
}
So you can make an element like <span class=“medal medal-3786961025”></span> and get the medal. You can get creative and use some CSS zoom and more to obtain different sizes, but to answer your question. I don’t think anyone has split them into their own images. A sprite is arguably faster as it loads one image, instead of x.
Ok, Thank You. I will try that out
There’s other ways too, but you need to use the other values supplied to display the correct part of the Sprite sheet.