public class Point extends AbstractPosition
Constructor and Description |
---|
Point(float posX,
float posY,
float height,
boolean relative)
Creates a point refering to a position in the game world.
|
Point(Point point)
Copy-constructor.
|
Modifier and Type | Method and Description |
---|---|
Point |
addVector(float[] vector)
Add a vector to the position
|
AbstractPosition |
addVector(float x,
float y,
float z) |
Point |
addVector(com.badlogic.gdx.math.Vector3 vector)
Add a vector to the position
|
Point |
cpy() |
float[] |
getAbs() |
float |
getAbsX() |
float |
getAbsY() |
Block |
getBlock() |
Block |
getBlockClamp() |
Block |
getBlockSafe()
Get the block at the position.
|
Coordinate |
getCoord()
returns coordinate aquivalent
|
Point |
getPoint()
Returns itself.
|
int |
getProjectedPosX() |
int |
getProjectedPosY() |
float[] |
getRel() |
float |
getRelX()
Get the game world position from left
|
float |
getRelY()
Get the game world position from top.
|
boolean |
onLoadedMap()
Checks if the position is on the chunks currently in memory.
|
static Coordinate |
toCoord(Point pos,
boolean depthCheck,
boolean visibilityCheck)
Game position to game coordinate
|
getHeight, getReferenceX, getReferenceY, setHeight
public Point(float posX, float posY, float height, boolean relative)
posX
- The distance from the left border of the map (game space)posY
- The distance from the top border of the map (game space)height
- The distance from ground (game space)relative
- true if relative to currently loaded map, false if absolute (relative to map with chunk 0,0 in its center)public Point(Point point)
point
- the source of the copypublic Point getPoint()
getPoint
in class AbstractPosition
public Coordinate getCoord()
getCoord
in class AbstractPosition
public float[] getRel()
public float getRelX()
public float getRelY()
public float[] getAbs()
public float getAbsX()
public float getAbsY()
public Block getBlock()
getBlock
in class AbstractPosition
AbstractPosition.getBlockSafe()
public Block getBlockSafe()
AbstractPosition
getBlockSafe
in class AbstractPosition
AbstractPosition.getBlock()
public Block getBlockClamp()
public Point cpy()
cpy
in class AbstractPosition
public int getProjectedPosX()
getProjectedPosX
in class AbstractPosition
public int getProjectedPosY()
getProjectedPosY
in class AbstractPosition
public boolean onLoadedMap()
AbstractPosition
onLoadedMap
in class AbstractPosition
public Point addVector(float[] vector)
addVector
in class AbstractPosition
vector
- all values in game world valuespublic Point addVector(com.badlogic.gdx.math.Vector3 vector)
addVector
in class AbstractPosition
vector
- all values in game world valuespublic AbstractPosition addVector(float x, float y, float z)
addVector
in class AbstractPosition
x
- x value to addy
- y value to addz
- height to addpublic static Coordinate toCoord(Point pos, boolean depthCheck, boolean visibilityCheck)
pos
- the position on the mapdepthCheck
- when true the coordiantes are checked with depth, use this for "screen to coords". This is only possible if the position are on the map.visibilityCheck
- if this is true the depth check requires the blocks to be invisibble to pass through. If false only will go through air (=ignore rendering)