April 2018
Beginner
714 pages
18h 21m
English
It is now time to practice our freshly acquired skills. The task is to add a particle effect to the game we created in the previous chapter. When the player collects a coin, it will explode into a sprinkle of colorful stars.
Start by declaring a particle system as filling the game scene, along with the particle painter definition:
ParticleSystem { id: coinParticles anchors.fill: parent // scene is the parent ImageParticle { source: "images/particle.png" colorVariation: 1 rotationVariation: 180 rotationVelocityVariation: 10 }}
Next, modify the definition of Coin to include an emitter:
Emitter { id: emitter system: coinParticles emitRate: 0 lifeSpan: 1500 lifeSpanVariation: 100 velocity: ...Read now
Unlock full access