If you don't see 3d graphics on this page, click for help.
| When the world starts | ||
| Do: |
|
|
| public void my_first_method ( ) {
Object[] schoolOfFish = ; |
||||
| doTogether { | ||||
| for (int index=0; index< 8 times ; index++) { | ||||
| For all schoolOfFish , every item_from_schoolOfFish together { | ||||
| world.swim ( whichFish = item_from_schoolOfFish ); | ||||
| } | ||||
| } | ||||
| world.sharkEatFish ( ); | ||||
| } | ||||
| } | ||||
| public void swim ( Object whichFish) {
Object fishTail = <None> ; |
|||
| fishTail .set( value , ( whichFish .partNamed( tail ) ) ); | |||
| doTogether { | |||
| doInOrder { | |||
| fishTail .turn( LEFT , 0.12 revolutions ); duration = 0.5 seconds style = BEGIN_ABRUPTLY_AND_END_GENTLY | |||
| fishTail .turn( RIGHT , 0.25 revolutions ); | |||
| fishTail .turn( LEFT , 0.12 revolutions ); duration = 0.5 seconds style = BEGIN_GENTLY_AND_END_ABRUPTLY | |||
| } | |||
| whichFish .move( FORWARD , 0.5 meters ); duration = 2 seconds style = BEGIN_AND_END_ABRUPTLY | |||
| } | |||
| } | |||
| public void sharkEatFish ( ) {
|
|||
| doTogether { | |||
| shark .moveToward( target = goldfish3.tail , amount = 3 meters ); duration = 8 seconds | |||
| doInOrder { | |||
| wait( 6 seconds ); | |||
| shark.jaw .turn( FORWARD , 0.1 revolutions ); | |||
| } | |||
| } | |||
| goldfish3 .set( opacity , 0 (0%) ); | |||
| shark.jaw .turn( BACKWARD , 0.1 revolutions ); | |||
| } | |||