Game Development Reference
In-Depth Information
• In
Transparency
, enter (
0
,
100
) (
100
,
0
) for
Chart
• In
Options
, select off for
Additive
and select
on
for
Continuous
Next, click on the
Save
button to save the file and then place it at
CanyonBunny-
android/assets/particles
.
There is no official file extension for particle effects in LibGDX.
Nonetheless, it does not do any harm to make things explicit
and name files after their intended purpose. As
sfx
is a
well-known abbreviation for sound effect, it makes sense to
follow this scheme and adapt it to the particle effect; hence,
the ile extension used in this topic is
.pfx
.
There is one more preparation required before we can start to implement the dust
particle effect in Canyon Bunny. As you already know, particle effects are made out
of images and so is our dust particle effect. You might have noticed that we skipped
over that part to select a proper (another) image file for the dust particle in the editor.
This is perfectly fine as we did not start from scratch, but instead used the already
existing particle image from the default fire particle effect. Its file is called
particle.
png
and can be found in the
assets
folder of the GDX tools. You can also download
it from LibGDX's repository at
https://raw.githubusercontent.com/libgdx/
The
particle.png
image basically contains just a small, white circle that smoothly
fades out from the center. The image should look like this:
Place the
particle.png
file in
CanyonBunny-android/assets/particles/
folder.
Next, add the following two import lines to the
BunnyHead
class:
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.ParticleEffect;
After this, add the following new line to the same class:
public ParticleEffect dustParticles = new ParticleEffect();