Can someone please help justifying classes and why they inheriting from actors. i would be very much appreciated.
An example would more than enough so i can guide myself through thank you.
Can someone please help justifying classes and why they inheriting from actors. i would be very much appreciated.
An example would more than enough so i can guide myself through thank you.
The World and Actor abstract classes are base classes for any and all worlds and actors. The greenfoot platform is built around these classes. You cannot create a world in greenfoot without a class that extends the World class and only Actor objects created from some extension of Actor are the only objects you can place into a World object. The inheritance of state and behavior from these abstract classes is nothing special to greenfoot, but is basic to the structure of how the java language (being an object-oriented programming language) deals with classes. Not all classes need to be a subclass of World or Actor in your projects written in greenfoot; however, like I stated earlier, one must be a subclass of World. As far as Actor subclasses, if you have anything in the world that (1) moves; (2) has a changing image; or (3) you may want to allow clicks on, then an Actor subclass would probably be the best way to handle it.