Package com.palepail.TestGame.Model

Source Code of com.palepail.TestGame.Model.Entity

package com.palepail.TestGame.Model;

import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.palepail.TestGame.Utilities.Configuration;
import com.palepail.TestGame.View.World;

public abstract class Entity {
  protected Vector2 position;
  protected float width;
  protected float height;
  protected Rectangle bounds;
  protected boolean active;
  private float alpha = 1f;
  protected boolean grazed = false;
  protected boolean deathGrazed = false;
  protected float time = 0;
  protected String spriteName = "missing";
  protected float renderScaleX =1*Configuration.gameScale/20;
  protected float renderScaleY =1*Configuration.gameScale/20;
  protected boolean flipX =false;
  protected boolean flipY =false;
 
 
 
  public static final String VARIATION_RED = "red";
  public static final String VARIATION_BLUE = "blue";
  public static final String VARIATION_GREEN = "green";
 
  protected String variation = VARIATION_BLUE;
  /**
   * @return the deathGrazed
   */
  public boolean isDeathGrazed() {
    return deathGrazed;
  }

  /**
   * @param deathGrazed the deathGrazed to set
   */
  public void setDeathGrazed(boolean deathGrazed) {
    this.deathGrazed = deathGrazed;
  }

  /**
   * @return the time
   */
  public float getTime() {
    return time;
  }

  /**
   * @param time the time to set
   */
  public void setTime(float time) {
    this.time = time;
  }

  /**
   * @return the grazed
   */
  public boolean isGrazed() {
    return grazed;
  }

  /**
   * @param grazed
   *            the grazed to set
   */
  public void setGrazed(boolean grazed) {
    this.grazed = grazed;
  }

  public float getAlpha() {
    return alpha;
  }

  /**
   * @return the active
   */
  public boolean isActive() {
    return active;
  }

  /**
   * @param active
   *            the active to set
   */
  public void setActive(boolean active) {
    this.active = active;
  }

  public Entity(Vector2 position, float width, float height) {
    this.position = position;
    this.width = width;
    this.height = height;
    bounds = new Rectangle(position.x, position.y, width, height);
  }

  /**
   * @return the position
   */
  public Vector2 getPosition() {
    return position;
  }

  /**
   * @param position
   *            the position to set
   */
  public void setPosition(Vector2 position) {
    this.position = position;
  }

  /**
   * @return the width
   */
  public float getWidth() {
    return width;
  }

  /**
   * @param width
   *            the width to set
   */
  public void setWidth(float width) {
    this.width = width;
  }

  /**
   * @return the height
   */
  public float getHeight() {
    return height;
  }

  /**
   * @param height
   *            the height to set
   */
  public void setHeight(float height) {
    this.height = height;
  }

  /**
   * @return the bounds
   */
  public Rectangle getBounds() {
    return bounds;
  }

  /**
   * @param bounds
   *            the bounds to set
   */
  public void setBounds(Rectangle bounds) {
    this.bounds = bounds;
  }

  /**
   * @return the renderScaleY
   */
  public float getRenderScaleX() {
    return renderScaleX;
  }



  /**
   * @param renderScaleY the renderScaleY to set
   */
  public void setRenderScaleX(float renderScaleX) {
    this.renderScaleX = renderScaleX;
  }
 
  /**
   * @return the renderScaleY
   */
  public float getRenderScaleY() {
    return renderScaleY;
  }



  /**
   * @param renderScaleY the renderScaleY to set
   */
  public void setRenderScaleY(float renderScaleY) {
    this.renderScaleY = renderScaleY;
  }



  /**
   * @return the flipX
   */
  public boolean isFlipX() {
    return flipX;
  }



  /**
   * @param flipX the flipX to set
   */
  public void setFlipX(boolean flipX) {
    this.flipX = flipX;
  }



  /**
   * @return the flipY
   */
  public boolean isFlipY() {
    return flipY;
  }

  public void addExplosions(World world) {
    world.putExplosion(getPosition().x + getWidth() / 2, getPosition().y + getHeight() / 2,
        getVariation());
    world.putSecondaryExplosion(getPosition().x + getWidth() / 2,
        getPosition().y + getHeight() / 2, getVariation());

  }

  /**
   * @param flipY the flipY to set
   */
  public void setFlipY(boolean flipY) {
    this.flipY = flipY;
  }

  public String getVariation() {
   
    return variation;
  }
 
public String getSpriteName() {
   
    return spriteName;
  }

public void setAlpha(float alpha) {
  this.alpha = alpha;
}
}
TOP

Related Classes of com.palepail.TestGame.Model.Entity

TOP
Copyright © 2018 www.massapi.com. 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.