can see camera working but not the actor gravity

This commit is contained in:
minjaesong
2017-06-28 22:15:42 +09:00
parent b0031c8a67
commit 299dec1476
55 changed files with 279 additions and 101 deletions

View File

@@ -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))

View File

@@ -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()
}
}
}