Package fr.formiko.kokcinelo.model
Class MapItem
java.lang.Object
fr.formiko.kokcinelo.model.MapItem
Abstact class that represent any thing on the map.
Moving map item are Creature.
- Since:
- 0.1
- Version:
- 0.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intHit radius is used as a hitBox for interaction -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTime(long timePaused) Add time to values that need it.floatdistanceTo(com.badlogic.gdx.math.Vector2 mi2) Return the distance between center point of this & stage coordinate.floatdistanceTo(MapItem mi2) Return the distance between center point of this & center point of an other MapItem.booleanEquals function that compare class then id.getActor()com.badlogic.gdx.math.Vector2floatfloatintintgetId()floatfloatgetZoom()inthashCode()booleanReturn true if hit box of the 2 MapItems are connected.booleanisInRadius(MapItem mi2, double radius) Return true if other MapItem is in radius.booleanmoveIn(float maxX, float maxY) voidvoidsetCenter(float x, float y) voidsetCenterX(float x) voidsetCenterY(float y) voidsetRandomLoaction(float maxX, float maxY) voidsetRotation(float degrees) voidsetZoom(float zoom) toString()
-
Field Details
-
hitRadius
protected int hitRadiusHit radius is used as a hitBox for interaction
-
-
Constructor Details
-
MapItem
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 Mapheight- height of Map
-
-
Method Details
-
getId
public int getId() -
getHitRadius
public int getHitRadius() -
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
-
hashCode
public int hashCode() -
equals
Equals function that compare class then id. -
hitBoxConnected
Return true if hit box of the 2 MapItems are connected. -
isInRadius
Return true if other MapItem is in radius. -
distanceTo
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
-