Listing 15. Code for the program named Alice0125e. 

Alice0125e's Code

Created by: Dick Baldwin

world

Events

When the world starts
Do:
world.main ( );


Methods

  public void main ( ) {
    
       // Program Alice0125d, Copyright 2007, R.G.Baldwin
  world.setTheStage ( );
  world.playTheShow ( );
  }


  public void setTheStage ( ) {
    
       doInOrder {
       // Align objects to the world
  // Note: The ground, the parking meter, and the skater
  // are invisible at startup
  ground .setPointOfView( world ); duration = 0 seconds
  parkingMeter .setPointOfView( world ); duration = 0 seconds
  iceSkater .setPointOfView( world ); duration = 0 seconds
  // Set the camera to a known viewpoint
  camera .setPointOfView( ground ); duration = 0 seconds
  camera .turn( RIGHT , 135/360 revolutions ); duration = 0 seconds
  camera .moveAwayFrom( target = parkingMeter , amount = 10 meters ); duration = 0 seconds
  camera .move( UP , 1.5 meters ); duration = 0 seconds
  // Set skater to her starting viewpoint
  iceSkater .turn( RIGHT , 0.25 revolutions ); duration = 0 seconds
  iceSkater .moveAwayFrom( target = parkingMeter , amount = 2 meters ); duration = 0 seconds
  // Cause the ground, the parking meter, and
  // the skater to become visible
  ground .set( opacity , 1 (100%) ); duration = 0 seconds
  parkingMeter .set( opacity , 1 (100%) ); duration = 1 second
  iceSkater .set( opacity , 1 (100%) ); duration = 2 seconds
  }
  }


  public void playTheShow ( ) {
    
       doInOrder {
       // Animate the skater's leg and foot
  iceSkater.leftLeg.lowerLeg .turn( FORWARD , 0.25 revolutions );
  iceSkater.leftLeg.lowerLeg.foot .turn( FORWARD , 0.12 revolutions );
  wait( 1 second );
  iceSkater.leftLeg.lowerLeg.foot .turn( BACKWARD , 0.12 revolutions );
  iceSkater.leftLeg.lowerLeg .turn( BACKWARD , 0.25 revolutions );
  }
  }