Hey there,
I’m working on an MMO as a school project. But I have some problems making multiple enemies with animations, I tried the following but it did not work.
java.lang.IllegalArgumentException: The given listener is already registed at this AnimControl
[java]
private void initEnemy1() {
kroko = assetManager.loadModel(“Models/monsters/kroko/box_ac3dmat1.mesh.j3o”);
kroko.setLocalScale(4.0f);
kroko.setLocalTranslation(-230, 18, 257); //xx yy zz
control6 = kroko.getControl(AnimControl.class);
control6.addListener(this);
channel6 = control6.createChannel();
rootNode.attachChild(kroko);
enemies.attachChild(kroko);
krokoWalk();
}
private void initEnemy2() {
kroko = assetManager.loadModel(“Models/monsters/kroko/box_ac3dmat1.mesh.j3o”);
kroko.setLocalScale(4.0f);
kroko.setLocalTranslation(-230, 18, 257); //xx yy zz
control7 = kroko.getControl(AnimControl.class);
control7.addListener(this);
channel7 = control7.createChannel();
rootNode.attachChild(kroko);
enemies.attachChild(kroko);
krokoWalk2();
}
[/java]
In krokoWalk i did the following:
[java]public void krokoWalk() {
channel6.addBone(“Bone”);
…
channel6.setAnim(“fight”, 0.40f);
channel6.setLoopMode(LoopMode.Loop);
}[/java]
and the same for krokowalk2 but with channel7.’
I have also tried the following but I get the same exception
[java]
private void createNPC(String Name, String pathToModel,String animation ,float scale, float x, float y, float z, float x2, float y2, float z2) {
…
createNPC(“kroko”, “Models/NPC/kroko.mesh.j3o”, “Walk”,3.0f, 65.77791f, 11.003154f, -327.38196f, 0f, -1.6f, 0f);
}
[/java]
I just can’t get it to work. I would love if someone could help me,
Thanks Jef
can you give us more details of the error from the stacktrace