Free act( ) getImage( ) getWorld( ) setLocation(x,y) setImage(image) Crab can change the way it behaves by defining its own "eat()" method to replace the Animal eat() method. We don't have to write any code! I can do all that? Freeฟรี act( ) moveWithKeybd animate()Ĭrab can redefine behavior, too. Animal canSee(Object) eat( Food ) move( ) actor behavior Crab animal behavior eatWithSound() actor behavior animal behaviorīenefit Crab getImage( ) getWorld( ) setImage(image) setLocation(x,y) canSee(Class) eat( Food ) move( ) turn( angle ) Crab gets all the behavior from Actor and Animalfor free. Crab can do anything an Animal can do, and anything an Actor can do, and. more behavior Crab is a special kind of Animal. Animal canSee(Object) eat( Food ) move( ) actor behaviorĪctor act( ) getX( ). Animal can do anything an Actor can do, and. Actor defines behavior for all kinds of actors.Īctor act( ) getX( ) getY( ) getWorld( ) getImage( ) setLocation(x,y) setImage(image) Animal is a subclass of Actor. "Extension" in Greenfoot Actor act( ) getX( ) getY( ) getImage( ) getWorld( ) rotate( angle ) setLocation(x,y) setImage(image) Actor is the base class. AutomaticCar drive( ) start( ) stop( ) accelerate( )
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |