使用LIBGDX和2个或更多发射器的粒子效应时遇到问题。
使用ParticleEditor创建我的.p文件后,我在我的代码中使用它...当我只使用1个发射器时它很好但是超过1,不好! :(
这是我在java控制台中的错误代码:
Exception in thread "LWJGL Application" java.lang.RuntimeException: Error parsing emitter: - Delay -
at com.badlogic.gdx.graphics.g2d.ParticleEmitter.load(ParticleEmitter.java:910)
at com.badlogic.gdx.graphics.g2d.ParticleEmitter.<init>(ParticleEmitter.java:95)
at com.badlogic.gdx.graphics.g2d.ParticleEffect.loadEmitters(ParticleEffect.java:154)
at com.badlogic.gdx.graphics.g2d.ParticleEffect.load(ParticleEffect.java:138)
at com.fasgame.fishtrip.android.screens.GameScreen.show(GameScreen.java:313)
at com.badlogic.gdx.Game.setScreen(Game.java:61)
at com.fasgame.fishtrip.android.screens.MainMenuScreen.render(MainMenuScreen.java:71)
at com.badlogic.gdx.Game.render(Game.java:46)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:206)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114)
Caused by: java.lang.NumberFormatException: For input string: "- Count -"
at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
at sun.misc.FloatingDecimal.parseFloat(Unknown Source)
at java.lang.Float.parseFloat(Unknown Source)
at com.badlogic.gdx.graphics.g2d.ParticleEmitter.readFloat(ParticleEmitter.java:929)
at com.badlogic.gdx.graphics.g2d.ParticleEmitter$RangedNumericValue.load(ParticleEmitter.java:1062)
at com.badlogic.gdx.graphics.g2d.ParticleEmitter.load(ParticleEmitter.java:866)
... 9 more
这是我的粒子效果.p文件:
Blanc
- Delay -
active: false
- Duration -
lowMin: 3000.0
lowMax: 3000.0
- Count -
min: 0
max: 200
- Emission -
lowMin: 0.0
lowMax: 0.0
highMin: 250.0
highMax: 250.0
relative: false
scalingCount: 1
scaling0: 1.0
timelineCount: 1
timeline0: 0.0
- Life -
lowMin: 500.0
lowMax: 500.0
highMin: 500.0
highMax: 500.0
relative: false
scalingCount: 3
scaling0: 1.0
scaling1: 0.47058824
scaling2: 0.0
timelineCount: 3
timeline0: 0.0
timeline1: 0.51369864
timeline2: 1.0
- Life Offset -
active: false
- X Offset -
active: false
- Y Offset -
active: false
- Spawn Shape -
shape: point
- Spawn Width -
lowMin: 0.0
lowMax: 0.0
highMin: 0.0
highMax: 0.0
relative: false
scalingCount: 1
scaling0: 1.0
timelineCount: 1
timeline0: 0.0
- Spawn Height -
lowMin: 0.0
lowMax: 0.0
highMin: 0.0
highMax: 0.0
relative: false
scalingCount: 1
scaling0: 1.0
timelineCount: 1
timeline0: 0.0
- Scale -
lowMin: 0.0
lowMax: 0.0
highMin: 70.0
highMax: 70.0
relative: true
scalingCount: 2
scaling0: 1.0
scaling1: 0.0
timelineCount: 2
timeline0: 0.0
timeline1: 1.0
- Velocity -
active: true
lowMin: 0.0
lowMax: 0.0
highMin: 30.0
highMax: 300.0
relative: false
scalingCount: 1
scaling0: 1.0
timelineCount: 1
timeline0: 0.0
- Angle -
active: true
lowMin: 220.0
lowMax: 320.0
highMin: 220.0
highMax: 320.0
relative: false
scalingCount: 2
scaling0: 0.0
scaling1: 0.98039216
timelineCount: 2
timeline0: 0.0
timeline1: 1.0
- Rotation -
active: false
- Wind -
active: false
- Gravity -
active: true
lowMin: 0.0
lowMax: 0.0
highMin: 0.0
highMax: 0.0
relative: false
scalingCount: 1
scaling0: 1.0
timelineCount: 1
timeline0: 0.0
- Tint -
colorsCount: 3
colors0: 0.50980395
colors1: 0.7647059
colors2: 0.7921569
timelineCount: 1
timeline0: 0.0
- Transparency -
lowMin: 0.0
lowMax: 0.0
highMin: 1.0
highMax: 1.0
relative: false
scalingCount: 4
scaling0: 1.0
scaling1: 1.0
scaling2: 1.0
scaling3: 1.0
timelineCount: 4
timeline0: 0.0
timeline1: 0.36301368
timeline2: 0.6164383
timeline3: 1.0
- Options -
attached: false
continuous: true
aligned: false
additive: true
behind: false
premultipliedAlpha: false
pre_particle.png
Bleu
- Delay -
active: false
- Duration -
lowMin: 3000.0
lowMax: 3000.0
- Count -
min: 0
max: 200
- Emission -
lowMin: 0.0
lowMax: 0.0
highMin: 250.0
highMax: 250.0
relative: false
scalingCount: 1
scaling0: 1.0
timelineCount: 1
timeline0: 0.0
- Life -
lowMin: 500.0
lowMax: 500.0
highMin: 500.0
highMax: 500.0
relative: false
scalingCount: 3
scaling0: 1.0
scaling1: 0.47058824
scaling2: 0.0
timelineCount: 3
timeline0: 0.0
timeline1: 0.51369864
timeline2: 1.0
- Life Offset -
active: false
- X Offset -
active: false
- Y Offset -
active: false
- Spawn Shape -
shape: point
- Spawn Width -
lowMin: 0.0
lowMax: 0.0
highMin: 0.0
highMax: 0.0
relative: false
scalingCount: 1
scaling0: 1.0
timelineCount: 1
timeline0: 0.0
- Spawn Height -
lowMin: 0.0
lowMax: 0.0
highMin: 0.0
highMax: 0.0
relative: false
scalingCount: 1
scaling0: 1.0
timelineCount: 1
timeline0: 0.0
- Scale -
lowMin: 0.0
lowMax: 0.0
highMin: 70.0
highMax: 70.0
relative: true
scalingCount: 2
scaling0: 1.0
scaling1: 0.0
timelineCount: 2
timeline0: 0.0
timeline1: 1.0
- Velocity -
active: true
lowMin: 0.0
lowMax: 0.0
highMin: 30.0
highMax: 300.0
relative: false
scalingCount: 1
scaling0: 1.0
timelineCount: 1
timeline0: 0.0
- Angle -
active: true
lowMin: 220.0
lowMax: 320.0
highMin: 220.0
highMax: 320.0
relative: false
scalingCount: 2
scaling0: 0.0
scaling1: 0.98039216
timelineCount: 2
timeline0: 0.0
timeline1: 1.0
- Rotation -
active: false
- Wind -
active: false
- Gravity -
active: true
lowMin: 0.0
lowMax: 0.0
highMin: 0.0
highMax: 0.0
relative: false
scalingCount: 1
scaling0: 1.0
timelineCount: 1
timeline0: 0.0
- Tint -
colorsCount: 3
colors0: 0.0
colors1: 0.7254902
colors2: 0.7921569
timelineCount: 1
timeline0: 0.0
- Transparency -
lowMin: 0.0
lowMax: 0.0
highMin: 1.0
highMax: 1.0
relative: false
scalingCount: 6
scaling0: 0.0
scaling1: 1.0
scaling2: 1.0
scaling3: 1.0
scaling4: 1.0
scaling5: 0.0
timelineCount: 6
timeline0: 0.0
timeline1: 0.047945205
timeline2: 0.34246576
timeline3: 0.6712329
timeline4: 0.94520545
timeline5: 1.0
- Options -
attached: false
continuous: true
aligned: false
additive: true
behind: false
premultipliedAlpha: false
pre_particle.png
BleuFonce
- Delay -
active: false
- Duration -
lowMin: 3000.0
lowMax: 3000.0
- Count -
min: 0
max: 200
- Emission -
lowMin: 0.0
lowMax: 0.0
highMin: 250.0
highMax: 250.0
relative: false
scalingCount: 1
scaling0: 1.0
timelineCount: 1
timeline0: 0.0
- Life -
lowMin: 500.0
lowMax: 500.0
highMin: 500.0
highMax: 500.0
relative: false
scalingCount: 3
scaling0: 1.0
scaling1: 0.47058824
scaling2: 0.0
timelineCount: 3
timeline0: 0.0
timeline1: 0.51369864
timeline2: 1.0
- Life Offset -
active: false
- X Offset -
active: false
- Y Offset -
active: false
- Spawn Shape -
shape: point
- Spawn Width -
lowMin: 0.0
lowMax: 0.0
highMin: 0.0
highMax: 0.0
relative: false
scalingCount: 1
scaling0: 1.0
timelineCount: 1
timeline0: 0.0
- Spawn Height -
lowMin: 0.0
lowMax: 0.0
highMin: 0.0
highMax: 0.0
relative: false
scalingCount: 1
scaling0: 1.0
timelineCount: 1
timeline0: 0.0
- Scale -
lowMin: 0.0
lowMax: 0.0
highMin: 70.0
highMax: 70.0
relative: true
scalingCount: 2
scaling0: 1.0
scaling1: 0.0
timelineCount: 2
timeline0: 0.0
timeline1: 1.0
- Velocity -
active: true
lowMin: 0.0
lowMax: 0.0
highMin: 30.0
highMax: 300.0
relative: false
scalingCount: 1
scaling0: 1.0
timelineCount: 1
timeline0: 0.0
- Angle -
active: true
lowMin: 220.0
lowMax: 320.0
highMin: 220.0
highMax: 320.0
relative: false
scalingCount: 2
scaling0: 0.0
scaling1: 0.98039216
timelineCount: 2
timeline0: 0.0
timeline1: 1.0
- Rotation -
active: false
- Wind -
active: false
- Gravity -
active: true
lowMin: 0.0
lowMax: 0.0
highMin: 0.0
highMax: 0.0
relative: false
scalingCount: 1
scaling0: 1.0
timelineCount: 1
timeline0: 0.0
- Tint -
colorsCount: 3
colors0: 0.0
colors1: 0.7294118
colors2: 1.0
timelineCount: 1
timeline0: 0.0
- Transparency -
lowMin: 0.0
lowMax: 0.0
highMin: 1.0
highMax: 1.0
relative: false
scalingCount: 4
scaling0: 1.0
scaling1: 0.0
scaling2: 0.0
scaling3: 1.0
timelineCount: 4
timeline0: 0.0
timeline1: 0.001
timeline2: 0.5753425
timeline3: 0.79452056
- Options -
attached: false
continuous: true
aligned: false
additive: true
behind: false
premultipliedAlpha: false
pre_particle.png
对于&#34; - 图像路径 - &#34;错过它是正常的,如果我让它们在它不起作用,即使只有一个发射器
PS:我已经将我的lib更新到上一个版本
答案 0 :(得分:2)
我通过打开我的粒子效果文件并删除说出的行来修复它:
- Image Path -
确保您使用的粒子编辑器的构建与项目中的LibGdx相同。
答案 1 :(得分:1)
如果在工具库中使用相同的ParticleEditor,那么你不应该这样做(这是我犯的错误)。
尝试删除spriteMode: single
并将- Image Paths -
更改为- Image Path -
。