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

2015/5/15

How do you get the act() method for world classes working?

298812kl2 298812kl2

2015/5/15

#
Hi. I am trying to use the act method for World classes, but the Greenfoot API says it does nothing. Is there a way to get it functioning similarly to the act() method for Actor classes?
davmac davmac

2015/5/15

#
I think you should read that API documentation more carefully: This method does nothing. It should be overridden in subclasses to implement an world's action. That gives you the answer to your question. Incidentally, the wording is almost the same as for the Actor's act method: The default implementation does nothing. This method should be overridden in subclasses to implement an actor's action. In other words, the act() method for the World and Actor subclasses works in exactly the same way. The only difference is that when you create an actor subclass, the class will have an empty act method in it by default. When you create a world subclass, you would need to add the act method in yourself in order to override the default implementation.
You need to login to post a reply.