repetitionEverywhere's Code

Created by: shr

world

Events

When the world starts
Do:
world.my first method


While ( both ( ( chicken distance to bunny ) > 2 ) and ( square . color == (0, 1, 0) ) ) is true
Begin:
  Do in order
       chicken turn to face bunny
  bunny turn to face chicken
During:
  Do in order
       chicken move forward 1 meter
  chicken.Neck turn backward 0.1 revolutions duration = 0.25 seconds
  chicken.Neck turn forward 0.1 revolutions duration = 0.25 seconds
  // Just to make sure he is still facing the bunny
  chicken turn to face bunny duration = 0 seconds
End:
  Do in order
       chicken say Hello


Let move world.animals


When ( both ( ( cow distance to chicken ) < 2 ) and ( square . color == (0, 1, 0) ) ) becomes true
Do:
  Do together
       cow say Moo
  cow play sound cow.moo (0:01.567)


When G is typed
Do:
square set color to (0, 1, 0)


When R is typed
Do:
square set color to (1, 0, 0)


Methods

  world.my first method ( )
    No variables
       Do in order
       bunny turn to face chicken
  chicken turn to face bunny
  Loop 5 times times
       Do in order
       chicken move forward 1 meter
  chicken.Neck turn backward 0.1 revolutions duration = 0.25 seconds
  chicken.Neck turn forward 0.1 revolutions duration = 0.25 seconds
  While ( ( chicken distance to bunny ) > 2 )
       Do in order
       chicken move forward 1 meter
  chicken.Neck turn backward 0.1 revolutions duration = 0.25 seconds
  chicken.Neck turn forward 0.1 revolutions duration = 0.25 seconds
  // Just to make sure he is still facing the bunny
  chicken turn to face bunny duration = 0 seconds
  chicken say Hello