parameterChallengeSolution's Code

Created by: SHR

world

Events

When the world starts
Do:
world.my first method


When is clicked on anything
Do:
bunny.eat ( object under mouse cursor )


Methods

  world.my first method ( )
    No variables
       bunny say I'm hungry!! Let's eat!


bunny

Methods

  bunny.eat ( [Obj] objectToEat)
    No variables
       // Right now the bunny will only visit the carrot and eat it no matter what is clicked on
  // Edit this method so any of bunny's treats can be clicked on and he can eat them!
  // WARNING: Bunny only likes healthy treats! He should not eat any cookies!
  // Add an EVENT to run the bunny.eat event when a treat is clicked on!
  bunny turn to face objectToEat
  bunny move ( ( ( bunny distance to objectToEat ) - 1 ) ) toward target = objectToEat
  If ( either ( either ( objectToEat == cookie ) or ( objectToEat == cookie2 ) , or both ) or ( objectToEat == cookie3 ) , or both )
       bunny say That's no good!
  Else
    If ( objectToEat == ground )
       bunny say That's the ground!
  Else
    bunny turn forward .18 revolutions
  objectToEat set isShowing to false duration = 0 seconds
  bunny turn backward 0.18 revolutions