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

2013/6/13

The act() method

Fadel Fadel

2013/6/13

#
How does the act method work? Its not a simple method like other. And how to write this kind of method in simple java?
danpost danpost

2013/6/13

#
The act method is just like any other method in java. The only thing that makes it special is that the Greenfoot system repeatedly calls the act method on all active objects while the scenario is running. Active objects include the active world and any actor object that is placed in that world. The act method can, however, be called on any object programmatically; but, this is not a very common occurrence. There are other methods that are automatically called in Greenfoot. These include the World class methods 'started' and 'stopped' as well as the Actor method 'addedToWorld'. These methods are not repeatedly called like the act method; but, are called once at their particular times. All these methods (including the act method) are empty methods (methods with no code initially placed in them) that can be over-ridden in your sub-classes of World and Actor by entering standard java code within them.
You need to login to post a reply.