Class MapItem

java.lang.Object
fr.formiko.kokcinelo.model.MapItem
Direct Known Subclasses:
BloodSpot, Creature

public abstract class MapItem extends Object
Abstact class that represent any thing on the map. Moving map item are Creature.
Since:
0.1
Version:
0.1
  • Field Details

    • hitRadius

      protected int hitRadius
      Hit radius is used as a hitBox for interaction
  • Constructor Details

    • MapItem

      protected MapItem(String textureName)
      Create a new MapItem with an actor using texture.
      Parameters:
      textureName - name of the texture to use from assets/images/
    • MapItem

      protected MapItem(int width, int height)
      Only for test constructor.
      Parameters:
      width - width of Map
      height - height of Map
  • Method Details

    • getId

      public int getId()
    • getHitRadius

      public int getHitRadius()
    • getActor

      public MapItemActor getActor()
    • getCenterX

      public float getCenterX()
    • getCenterY

      public float getCenterY()
    • getCenter

      public com.badlogic.gdx.math.Vector2 getCenter()
    • setCenterX

      public void setCenterX(float x)
    • setCenterY

      public void setCenterY(float y)
    • setCenter

      public void setCenter(float x, float y)
    • moveIn

      public boolean moveIn(float maxX, float maxY)
    • getRotation

      public float getRotation()
    • setRotation

      public void setRotation(float degrees)
    • setRandomLoaction

      public void setRandomLoaction(float maxX, float maxY)
    • setZoom

      public void setZoom(float zoom)
    • getZoom

      public float getZoom()
    • removeActor

      public void removeActor()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Equals function that compare class then id.
      Overrides:
      equals in class Object
    • hitBoxConnected

      public boolean hitBoxConnected(MapItem it)
      Return true if hit box of the 2 MapItems are connected.
    • isInRadius

      public boolean isInRadius(MapItem mi2, double radius)
      Return true if other MapItem is in radius.
    • distanceTo

      public float distanceTo(MapItem mi2)
      Return the distance between center point of this & center point of an other MapItem.
    • distanceTo

      public float distanceTo(com.badlogic.gdx.math.Vector2 mi2)
      Return the distance between center point of this & stage coordinate.
    • addTime

      public void addTime(long timePaused)
      Add time to values that need it. It is used when the game is resume to avoid that creature can hit & shoot again even if game time have'nt run.
      Parameters:
      timePaused - time that have run bewteen pause & resume