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

Tuning the emitter

You can control the amount of particles being emitted by setting the emitRate property of the emitter. Another property, called the lifeSpandetermines how many milliseconds it takes before a particle dies. To introduce some random behavior, you can use the lifeSpanVariation property to set a maximum amount of time (in milliseconds) the life span can be altered by the system (in both directions):

Emitter {    anchors.fill: parent    emitRate: 350    lifeSpan: 1500    lifeSpanVariation: 400 // effective: 1100-1900 ms} 

A possible result of this change is shown in the following picture:

Increasing the emission rate and life span of particles ...

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