mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-14 20:44:05 +09:00
can see camera working but not the actor gravity
This commit is contained in:
@@ -101,7 +101,7 @@ object BlocksDrawer {
|
||||
val tileItemImgPixMap = Pixmap(TILE_SIZE * 16, TILE_SIZE * GameWorld.TILES_SUPPORTED / 16, Pixmap.Format.RGBA8888)
|
||||
tileItemImgPixMap.pixels.rewind()
|
||||
|
||||
(ITEM_TILES).forEach { tileID ->
|
||||
for (tileID in ITEM_TILES) {
|
||||
|
||||
val tile = tilesTerrain.get((tileID % 16) * 16, (tileID / 16))
|
||||
|
||||
|
||||
@@ -16,6 +16,10 @@ object WorldCamera {
|
||||
private set
|
||||
var y: Int = 0
|
||||
private set
|
||||
var gdxCamX: Float = 0f
|
||||
private set
|
||||
var gdxCamY: Float = 0f
|
||||
private set
|
||||
var width: Int = 0
|
||||
private set
|
||||
var height: Int = 0
|
||||
@@ -42,6 +46,14 @@ object WorldCamera {
|
||||
world!!.height * TILE_SIZE - height - TILE_SIZE.toFloat()
|
||||
))
|
||||
|
||||
|
||||
gdxCamX = Math.round(// X only: ROUNDWORLD implementation
|
||||
(player?.hitbox?.centeredX?.toFloat() ?: 0f)).toFloat()
|
||||
gdxCamY = Math.round(FastMath.clamp(
|
||||
(player?.hitbox?.centeredY?.toFloat() ?: 0f),
|
||||
TILE_SIZE.toFloat(),
|
||||
world!!.height * TILE_SIZE - height - TILE_SIZE.toFloat()
|
||||
)).toFloat()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user