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

2016/6/2

actor cannot be added into world

FutureCoder FutureCoder

2016/6/2

#
I tried to put an actor in the world by dragging it and this error message came up 'java.lang.NoClassDefFoundError: Could not initialize class enemy'. Then i tried adding it in the world class. still it doesn't work. How can i fix this?
danpost danpost

2016/6/2

#
FutureCoder wrote...
I tried to put an actor in the world by dragging it and this error message came up 'java.lang.NoClassDefFoundError: Could not initialize class enemy'. Then i tried adding it in the world class. still it doesn't work. How can i fix this?
Please post the class code for the enemy.
FutureCoder FutureCoder

2016/6/2

#
Do you mean the entire code for enemy
FutureCoder FutureCoder

2016/6/2

#
i don't think the code is the problem, because it compiles perfectly. Also nothing has changed since yesterday, and everything was working fine
danpost danpost

2016/6/2

#
FutureCoder wrote...
Do you mean the entire code for enemy
Yes. Maybe something was accidentally changed.
FutureCoder FutureCoder

2016/6/2

#
no, nothing was changed, i just opened up greenfoot and tried to add the actor into the world and it wasn't working
danpost danpost

2016/6/2

#
Try copying the entire code in the class to a temporary location (to retain a copy of the class), then remove the class and add a new subclass of Actor to copy the code back into (replacing the entire default script). Then recompile and test it out.
FutureCoder FutureCoder

2016/6/2

#
Thanks, it all works now
You need to login to post a reply.