This site requires JavaScript, please enable it in your browser!
Greenfoot back
Solringolt
Solringolt wrote ...

2013/5/3

An animation function ?

1
2
3
Solringolt Solringolt

2013/5/7

#
It's maybe the first thing then.. in my enemy class I call checkType in the act method and checkType() calls colisionCheck()
danpost danpost

2013/5/7

#
I do not think so. Since checkType is called from the act method, which I presume is called by the system while running the animation, the actor must be in the world and therefore no NullPointerException would occur on line 70 (as you have it posted) in the Actions class. The only way that error would occur on that line is if the actor was not in the world at the time that line is executed. I did not see any code removing the object from the world in the act method, the checkType method or the colisionCheck method to that point.
Solringolt Solringolt

2013/5/7

#
You're right it isn't the colisionCheck(). I put it in commentary and I know get the error at line 92 of the class Enemy. The problem is in the animate() metod.
Solringolt Solringolt

2013/5/7

#
An other clue... the program just completly shut down as soon as I add an enemy BEFORE my Hero in the world. O.o I have a big problem...
danpost danpost

2013/5/7

#
Solringolt wrote...
You're right it isn't the colisionCheck(). I put it in commentary and I know get the error at line 92 of the class Enemy. The problem is in the animate() metod.
By commenting the line with the error, you only post-poned the error until the animate code. You need to look backward (not forward) for the cause of the error.
Solringolt Solringolt

2013/5/7

#
And what means the second fact? As soon as I add an enemy there is an error. If it's not the animate method where could the problem be? The Scenario
danpost danpost

2013/5/7

#
For starters, change line 31 of the Enemy class to
for(int j=0; j<3; j++) for (int k=0;k<frames.length;k++) allFrames[j][k]=new GreenfootImage("enemy"+j+"touch"+(k+1)+".png");
danpost danpost

2013/5/7

#
Then, change line 37 of the Enemy class to
if (getWorld != null) animate();
You need to login to post a reply.
1
2
3