Package dwlab.shapes.sprites

Examples of dwlab.shapes.sprites.Sprite


 
  @Override
  public void init() {
    for( int n = 1; n <= spritesQuantity; n++ ) {
      Sprite sprite = new Sprite( ShapeType.oval, Service.random( -15, 15 ), Service.random( -11, 11 ), 1d, 1d );
      sprite.setDiameter( Service.random( 0.5, 1.5 ) );
      sprite.visualizer.setRandomColor();
      Layer.addLast( sprite );
    }
    cursor = new Sprite( ShapeType.oval, 0d, 0d, 0.5d, 0.5d );
    lineSegment.pivot[ 0 ] = cursor;
  }
View Full Code Here


  @Override
  public void logic() {
    minSprite = null;
    double minDistance = 0;
    for( Shape shape : Layer.children ) {
      Sprite sprite = shape.toSprite();
      if( cursor.distanceTo( sprite ) < minDistance || minSprite == null ) {
        minSprite = sprite;
        minDistance = cursor.distanceTo( sprite );
      }
    }
View Full Code Here

  ButtonAction setDestination = ButtonAction.create( MouseButton.create( MouseButton.RIGHT_BUTTON ) );
 
 
  @Override
  public void init() {
    cursor = new Sprite( ShapeType.oval, 0, 0, 0.5, 0.5 );
    for( int n = 0; n <= pivotsQuantity; n++ ) {
      while( true ) {
        double x = Service.random( -15,15 );
        double y = Service.random( -11, 11 );
        boolean passed = true;
        for( Sprite pivot : graph.contents.keySet() ) {
          if( pivot.distanceTo( x, y ) < minDistance ) {
            passed = false ;
            break;
          }
        }
        if( passed ) {
          graph.addPivot( new Sprite( x, y, 0.3 ) );
          break;
        }
      }
    }
    for( Sprite pivot1 : graph.contents.keySet() ) {
View Full Code Here

    if( setSource.wasPressed() ) {
      selectedPivot = graph.findPivotCollidingWithSprite( cursor );
      path = null;
    }
    if( setDestination.wasPressed() && selectedPivot != null ) {
      Sprite selectedPivot2 = graph.findPivotCollidingWithSprite( cursor );
      if( selectedPivot2 != null ) path = graph.findPath( selectedPivot, selectedPivot2 );
    }
  }
View Full Code Here

 
 
  @Override
  public void init() {
    for( int n = 1; n <= spritesQuantity; n++ ) {
      Sprite sprite = new Sprite( ShapeType.oval, Service.random( -15, 15 ), Service.random( -11, 11 ), 0, 0 );
      sprite.setDiameter( Service.random( 1, 3 ) );
      sprite.displayingAngle= Service.random( 360 );
      sprite.visualizer.setRandomColor();
      sprite.visualizer.image = spriteImage;
      sprite.visualizer.setVisualizerScales( 1.3 );
      sprites.addLast( sprite );
View Full Code Here

 
  @Override
  public void init() {
    for( int n = 0; n < 9; n++ ) {
      ShapeType shapeType = ShapeType.shapeTypes.get( n );
      Sprite sprite = new Sprite( shapeType, ( n % 3 ) * 8d - 8d, Math.floor( n / 3 ) * 6d - 6d, 6d, 4d );
      if( shapeType == ShapeType.raster ) sprite.visualizer.image = image;
      sprite.visualizer.set( "7FFF7F" );
      sprite.angle = 60;
      sprites.addLast( sprite );
    }
View Full Code Here

  @Override
  public void render() {
    sprites.draw();
    for( Shape shape : sprites.children ) {
      Sprite sprite = shape.toSprite();
      if( cursor.collidesWith( sprite ) ) {
        sprite.visualizer.set( "FF7F7F" );
        Sprite wedgedCursor = cursor.clone();
        wedgedCursor.wedgeOffWith( sprite, 0, 1 );
        wedgedCursor.visualizer.set( "7F7FFF7F" );
        wedgedCursor.draw();
      } else {
        sprite.visualizer.set( "7FFF7F" );
      }
    }
    cursor.draw();
View Full Code Here

    };

    int allPivots[][] = { { -4, -2, -2, -2 }, { -4, -2, -4, 0 }, { -4, 0, -4, 2 }, { -4, 0, -3, 0 }, { 1, -2, -1, -2 }, { -1, -2, -1, 0 }, { -1, 0, 1, 0 },
        { 1, 0, 1, 2 }, { 1, 2, -1, 2 }, { 4, -2, 2, -2 }, { 2, -2, 2, 0 }, { 2, 0, 2, 2 }, { 2, 0, 3, 0 } };
    for( int[] pivots : allPivots ) {
      LineSegment lineSegment = new LineSegment( new Sprite( pivots[ 0 ], pivots[ 1 ] ), new Sprite( pivots[ 2 ], pivots[ 3 ] ) );
      lineSegment.visualizer = visualizer;
      lineSegments.addLast( lineSegment );
    }
  }
View Full Code Here

 
  @Override
  public void init() {
    for( int n = 1; n <= spritesQuantity; n++ ) {
      Sprite sprite = new Sprite( ShapeType.oval, Service.random( -15d, 15d ), Service.random( -11d, 11d ), 1d, 1d, Service.random( 360 ), 0d );
      sprite.setDiameter( Service.random( 0.7, 2 ) );
      sprite.visualizer.setRandomColor();
      sprite.visualizer.setVisualizerScales( 1.3 );
      sprite.visualizer.image = spriteImage;
      Layer.addLast( sprite );
    }
View Full Code Here

 
  @Override
  public void init() {
    for( int n = 0; n < flowersQuantity; n++ ) {
      flowers[ n ] = new Sprite();
      flowers[ n ].setDiameter( flowerDiameter );
    }
  }
View Full Code Here

TOP

Related Classes of dwlab.shapes.sprites.Sprite

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.