【发布时间】:2016-09-23 12:55:22
【问题描述】:
我需要根据游戏中的某些用户事件更改粒子效果颜色的颜色,因为这就是我正在做的事情:
float temp[] = new float[4];
temp[0] = 0.937f;
temp[1] = 0.325f;
temp[2] = 0.314f;
pe.getEmitters().first().getTint().setColors(temp);
pe.start();
在渲染中我正在这样做:
pe.draw(batch, Gdx.graphics.getDeltaTime());
但不幸的是我收到了这个错误:
java.lang.ArrayIndexOutOfBoundsException: length=4; index=4
at com.badlogic.gdx.graphics.g2d.ParticleEmitter$GradientColorValue.getColor(ParticleEmitter.java:1313)
at com.badlogic.gdx.graphics.g2d.ParticleEmitter.activateParticle(ParticleEmitter.java:439)
at com.badlogic.gdx.graphics.g2d.ParticleEmitter.addParticle(ParticleEmitter.java:154)
at com.badlogic.gdx.graphics.g2d.ParticleEmitter.draw(ParticleEmitter.java:299)
at com.badlogic.gdx.graphics.g2d.ParticleEffect.draw(ParticleEffect.java:74)
at com.approduction.game.GameScreen.render(GameScreen.java:218)
at com.badlogic.gdx.Game.render(Game.java:46)
at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:459)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1557)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1263)
我不知道我做错了什么,我阅读了文档并按照它做了所有的事情任何帮助都会是一个救星......提前谢谢......
【问题讨论】:
标签: libgdx game-engine