Game Programming using Qt 5 Beginner's Guide - Second Edition
by Pavel Strakhov, Witold Wysota, Lorenz Haas
What just happened?
We replaced the previous static image with an ever-changing source with a different item. As the Sprite parameter is not an Item element but a data definition of a sprite, we cannot use it in place of the Image element. Instead, we will use the AnimatedSprite element, which is an item that can display a single animated sprite defined inline. It even has the same set of properties as the Sprite parameter. We defined a sprite embedded in images/sprite.png with a width of 80 and a height of 52 pixels. The sprite consists of seven frames that should be displayed at a rate of 10 frames per second. The running property is set up similar to the original Animation element. As the AnimatedSprite element does not have a mirror ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access