O'Reilly logo

Game Programming using Qt 5 Beginner's Guide - Second Edition by Lorenz Haas, Witold Wysota, Pavel Strakhov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required