Package dwlab.behavior_models

Examples of dwlab.behavior_models.ModelDeactivator


  @Override
  public void init() {
    attachModelImmediately( gravity );


    attachModelImmediately( new ModelDeactivator( onLand, true ) );


    addTileMapCollisions( Group.HORIZONTAL, BehaviorModelExample.instance.tileMap, pushFromWalls, bricks );
    addTileMapCollisions( Group.VERTICAL, BehaviorModelExample.instance.tileMap, verticalCollisionHandler, bricks );
    addLayerCollisions( Group.ALL, BehaviorModelExample.instance.layer, awPossumHurtingCollision );


    addToStack( hurtingAnimation );
    addToStack( punchingAnimation );
    addToStack( kickingAnimation );

    jumpingAnimation = new AnimationModel( false, jumpingAnimationSpeed, 2, 8 );
    addToStack( jumpingAnimation );

    fallingAnimation = new AnimationModel( true, jumpingAnimationSpeed, 1, 10 );
    jumpingAnimation.nextModels.addLast( new ModelActivator( fallingAnimation ) );
    addToStack( fallingAnimation );

    addToStack( movementAnimation );


    attachModel( movementControl );


    IsButtonActionDown jumpKeyDown = IsButtonActionDown.create( jumpKey );
    attachModel( jumpKeyDown );
    jumpKeyDown.falseModels.addLast( jumpKeyDown );

    IsModelActive onLandCondition = new IsModelActive( onLand );
    jumpKeyDown.trueModels.addLast( onLandCondition );

    onLandCondition.trueModels.addLast( new ModelActivator( jumpingAnimation ) );
    onLandCondition.trueModels.addLast( new ModelDeactivator( gravity ) );
    onLandCondition.falseModels.addLast( jumpKeyDown );

    FixedWaitingModel pauseBeforeJump = FixedWaitingModel.create( jumpingPause );
    pauseBeforeJump.nextModels.addLast( new Jump( jumpingStrength, jumpingStrength ) );
    pauseBeforeJump.nextModels.addLast( new ModelActivator( gravity ) );
View Full Code Here


  @Override
  public void init() {
    attachModelImmediately( gravity );
   
    attachModelImmediately( new ModelDeactivator( onLand, true ) );
   
    addTileMapCollisions( Group.HORIZONTAL, instance.tileMap, bumpingWalls, null );
    addTileMapCollisions( Group.VERTICAL, instance.tileMap, verticalCollisionHandler, null );

    jumpingAnimation = new AnimationModel( false, jumpingAnimationSpeed, 8, 8 );
    fallingAnimation = new AnimationModel( true, jumpingAnimationSpeed, 3, 13, true );
    AnimationModel firingAnimation = new AnimationModel( false, firingAnimationSpeed, 8, 16 );


    if( parameterExists( "jumping" ) ) {
      double[] parameters= getDoubleParameters( "jumping", "-" );
      RandomWaitingModel waitingForJump = new RandomWaitingModel( parameters[ 0 ], parameters[ 1 ] );
      attachModel( waitingForJump );

      IsModelActive onLandCondition = new IsModelActive( onLand );
      waitingForJump.nextModels.addLast( onLandCondition );

      IsModelActive animationActive = new IsModelActive( firingAnimation );
      onLandCondition.trueModels.addLast( animationActive );
      onLandCondition.falseModels.addLast( waitingForJump );

      animationActive.trueModels.addLast( waitingForJump );
      animationActive.falseModels.addLast( new ModelActivator( jumpingAnimation ) );
      animationActive.falseModels.addLast( new ModelDeactivator( horizontalMovementModel() ) );
      animationActive.falseModels.addLast( new ModelDeactivator( gravity ) );

      jumpingAnimation.nextModels.addLast( new ModelActivator( fallingAnimation ) );

      parameters= getDoubleParameters( "jumping_strength", "-" );
      FixedWaitingModel pauseBeforeJump = FixedWaitingModel.create( jumpingPause );
      pauseBeforeJump.nextModels.addLast( new Jumpparameters[ 0 ], parameters[ 1 ] ) );
      pauseBeforeJump.nextModels.addLast( new ModelActivator( horizontalMovementModel() ) );
      pauseBeforeJump.nextModels.addLast( new ModelActivator( gravity ) );
      pauseBeforeJump.nextModels.addLast( waitingForJump );
      animationActive.falseModels.addLast( pauseBeforeJump );

      addToStack( jumpingAnimation );
      score += 200;
    }


    addToStack( fallingAnimation );


    if( parameterExists( "firing" ) ) {
      double[] parameters = getDoubleParameters( "firing", "-" );
      RandomWaitingModel waitingForFire = new RandomWaitingModel( parameters[ 0 ], parameters[ 1 ] );
      attachModel( waitingForFire );

      IsModelActive onLandCondition = new IsModelActive( onLand );
      waitingForFire.nextModels.addLast( onLandCondition );

      IsModelActive animationActive = new IsModelActive( jumpingAnimation );
      onLandCondition.trueModels.addLast( animationActive );
      onLandCondition.falseModels.addLast( waitingForFire );

      animationActive.trueModels.addLast( waitingForFire );
      animationActive.falseModels.addLast( new ModelActivator( firingAnimation ) );
      animationActive.falseModels.addLast( new ModelDeactivator( horizontalMovementModel() ) );

      firingAnimation.nextModels.addLast( new ModelActivator( horizontalMovementModel() ) );

      parameters = getDoubleParameters( "firing_speed", "-" );
      FixedWaitingModel pauseBeforeBullet = FixedWaitingModel.create( bulletPause );
View Full Code Here

TOP

Related Classes of dwlab.behavior_models.ModelDeactivator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.