If you don't see 3d graphics on this page, click for help.
| world.my first method ( )
No variables |
||
| // The penguins take turns jumping, each jumping 2 times total. | ||
| Loop 2 times times | ||
| penguin.jump times = 1 | ||
| penguin2.jump times = 1 | ||
| // The penguin tries to swim in hole2. | ||
| penguin.fallInHole whichHole = hole2 | ||
| // If the penguin did not go into hole2, the penguin now goes to hole. | ||
| If ( ( penguin distance above hole2 ) > -1 ) | ||
| penguin say I'm not in the hole | ||
| penguin.fallInHole whichHole = hole | ||
| Else | ||
| // The penguin did go into hole2. | ||
| penguin say I am swimming! | ||
| penguin.fallInHole ( [Obj] whichHole)
distanceToHole = 1 , holeRadius = 1 |
||||
| // The penguin is lazy and only walks to the hole if it is close. | ||||
| If ( penguin is within 5 meters of whichHole ) | ||||
| // Walk to the edge of the hole. | ||||
| penguin turn to face whichHole | ||||
| holeRadius set value to ( ( ( subject = whichHole 's width ) / 2 ) ) | ||||
| distanceToHole set value to ( ( ( penguin distance to whichHole ) - holeRadius ) ) | ||||
| penguin.walking x = distanceToHole | ||||
| // The penguin waits for global warming to have its effect, making the hole large enough for the penguin to fit. | ||||
| // The penguin walks around the hole while waiting. | ||||
| While ( penguin is wider than whichHole ) | ||||
| penguin turn left 1 revolution asSeenBy = whichHole | ||||
| whichHole resize 1.1 | ||||
| // Now that the hole is big enough, the penguin dives in. | ||||
| Do together | ||||
| penguin.jump times = 1 | ||||
| penguin turn forward 0.5 revolutions | ||||
| Do in order | ||||
| Wait 0.5 seconds | ||||
| penguin move to whichHole | ||||
| penguin move up 5 meters duration = 0 seconds | ||||
| Else | ||||
| Do Nothing | ||||