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 int
Hit radius is used as a hitBox for interaction -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addTime
(long timePaused) Add time to values that need it.float
distanceTo
(com.badlogic.gdx.math.Vector2 mi2) Return the distance between center point of this & stage coordinate.float
distanceTo
(MapItem mi2) Return the distance between center point of this & center point of an other MapItem.boolean
Equals function that compare class then id.getActor()
com.badlogic.gdx.math.Vector2
float
float
int
int
getId()
float
float
getZoom()
int
hashCode()
boolean
Return true if hit box of the 2 MapItems are connected.boolean
isInRadius
(MapItem mi2, double radius) Return true if other MapItem is in radius.boolean
moveIn
(float maxX, float maxY) void
void
setCenter
(float x, float y) void
setCenterX
(float x) void
setCenterY
(float y) void
setRandomLoaction
(float maxX, float maxY) void
setRotation
(float degrees) void
setZoom
(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
-