bunnyHopAndEatBroccoli's Code

Created by: S Rodger

world

Events

When the world starts
Do:
world.my first method


Methods

  world.my first method ( )
    No variables
       Loop 3 times times
       bunny.hop
  bunny say hop duration = 0.5 seconds
  For all world.food , one item_from_food at a time
       item_from_food turn right 1 revolution
  bunny.eat tastyMorsel = item_from_food
  Do in order
       // now go eat all the food
  bunny.eat tastyMorsel = broccoli
  bunny.eat tastyMorsel = broccoli2
  bunny.eat tastyMorsel = broccoli3


bunny

Methods

  bunny.hop ( )
    No variables
       Do together
       Do in order
       bunny move up 0.5 meters duration = 0.25 seconds
  bunny move down 0.5 meters duration = 0.25 seconds
  bunny move forward 0.25 meters duration = 0.5 seconds


  bunny.eat ( [Obj] tastyMorsel)
    No variables
       bunny turn to face tastyMorsel
  // hop over to the tasty morsel
  While ( ( bunny distance to tastyMorsel ) > 0.5 )
       bunny.hop
  // Just to make sure we are still facing the food head on
  bunny turn to face tastyMorsel duration = 0 seconds
  // now eat the tasty morsel
  bunny turn forward 0.2 revolutions duration = 0.5 seconds
  tastyMorsel set isShowing to false duration = 0.5 seconds
  bunny turn backward 0.2 revolutions duration = 0.5 seconds