Package com.badlogic.gdx.math

Examples of com.badlogic.gdx.math.Rectangle


   */
  public Tank(TextureRegion tex, TextureRegion cannon, TextureRegion[] weaponsTex, boolean first, int x, int y, Map map){
    this.tex = tex;
    this.cannon = cannon;
    this.position = new Vector2(x,y);
    this.bounds = new Rectangle(x,y,32,16);
    this.slope = map.getAngle(x);
    this.map = map;
    if(!first){
      state = RECEIVING;
      angle = 120;
View Full Code Here


   * Shoot the weapon
   */
  public void shoot(){
    velocity = new Vector2(shooter.getPower()* MathUtils.cosDeg(shooter.getAngle()) * POWER_FACTOR , shooter.getPower() * MathUtils.sinDeg(shooter.getAngle()) * POWER_FACTOR);
    position = new Vector2(shooter.getPosition());
    bounds = new Rectangle(position.x,position.y,1,1);
  }
View Full Code Here

  /**
   * Detects collision with the tank, given rectangular bounds
   * @return True if hit tank
   */
  protected boolean detectTankCollision(){
    Rectangle otherTankBounds = Engine.getInstance().getOtherTank(shooter).getBounds();
    if(bounds.overlaps(otherTankBounds)){
      return true;
    }
    return false;
  }
View Full Code Here

   * @param radius Explosion radius
   * @return True if tank is in radius
   */
  protected boolean detectExplosionRadius(float radius){
    Circle temp = new Circle(position.x, position.y, radius);
    Rectangle otherTankBounds = Engine.getInstance().getOtherTank(shooter).getBounds();
    if(Intersector.overlapCircleRectangle(temp, otherTankBounds)){
      return true;
    }
    return false;
  }
View Full Code Here

   * avoids drawing children completely outside the {@link #setCullingArea(Rectangle) culling area}, if set. */
  protected void drawChildren (Batch batch, float parentAlpha) {
    parentAlpha *= this.color.a;
    SnapshotArray<Actor> children = this.children;
    Actor[] actors = children.begin();
    Rectangle cullingArea = this.cullingArea;
    if (cullingArea != null) {
      // Draw children only if inside culling area.
      float cullLeft = cullingArea.x;
      float cullRight = cullLeft + cullingArea.width;
      float cullBottom = cullingArea.y;
View Full Code Here

   * {@link #clipEnd()} if true is returned.
   * @return false if the clipping area is zero and no drawing should occur.
   * @see ScissorStack */
  public boolean clipBegin (float x, float y, float width, float height) {
    if (width <= 0 || height <= 0) return false;
    Rectangle tableBounds = Rectangle.tmp;
    tableBounds.x = x;
    tableBounds.y = y;
    tableBounds.width = width;
    tableBounds.height = height;
    Stage stage = this.stage;
    Rectangle scissorBounds = Pools.obtain(Rectangle.class);
    stage.calculateScissors(tableBounds, scissorBounds);
    if (ScissorStack.pushScissors(scissorBounds)) return true;
    Pools.free(scissorBounds);
    return false;
  }
View Full Code Here

        }

      }

      String name = packPrefix + c;
      Rectangle rect = packer.pack(name, pixmap);

      // determine which page it was packed into
      int pIndex = packer.getPageIndex(name);
      if (pIndex == -1) // we should not get here
        throw new IllegalStateException("packer was not able to insert '" + name + "' into a page");
View Full Code Here

    final float yWhenShown = height - topPanel.getHeight() + 13;
    final float yWhenHidden = height - 60 + 13;

    if( usePanelAnimator ) {
      panelShown = false;
      panelAnimator = new TopPanelAnimator( topPanel, new Rectangle( 10, 5, width - 20, 60 ), yWhenShown, yWhenHidden );
      topPanel.setY( yWhenHidden );
      topPanel.add( tZoomer ).expandX();
      topPanel.setColor( 1f, 1f, 1f, 0.5f );
    } else {
      panelShown = true;
View Full Code Here

        panel.addAction( Actions.moveTo( panel.getX(), yShow, 0.5f, Interpolation.exp10 ) );
        panel.addAction( Actions.alpha( 1f, 0.5f, Interpolation.exp10 ) );

        // resize hotzone rect to let the user move in the whole area
        Rectangle hz = hotZone.getHotZone();
        hz.setHeight( openedHotZoneHeight );
        hotZone.setHotZone( hz );

        // Gdx.app.log( "PanelAnimator", "Start showing" );
      }
    } else {
View Full Code Here

        panel.addAction( Actions.moveTo( panel.getX(), yHidden, 0.5f, Interpolation.exp10 ) );
        panel.addAction( Actions.alpha( 0.5f, 0.5f, Interpolation.exp10 ) );

        // restore original hotzone height
        Rectangle hz = hotZone.getHotZone();
        hz.setHeight( closedHotZoneHeight );
        hotZone.setHotZone( hz );

        // Gdx.app.log( "PanelAnimator", "Start hiding" );
      }
    } else {
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.math.Rectangle

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.