door and its ghost now spawns at the right position in the world

This commit is contained in:
minjaesong
2022-07-19 21:46:59 +09:00
parent 06ef46d369
commit 78d249cb6e
6 changed files with 83 additions and 77 deletions

View File

@@ -66,10 +66,9 @@ class BlockMarkerActor : ActorWithBody(Actor.RenderOrder.OVERLAY, physProp = Phy
override fun update(delta: Float) {
if (isVisible) {
hitbox.setPosition(
Terrarum.mouseTileX * TILE_SIZED,
(Terrarum.mouseTileY - floor((hitbox.height - 0.5) / TILE_SIZED)) * TILE_SIZED
)
val hbx = (Terrarum.mouseTileX - floor((hitbox.width - 0.5).div(2) / TILE_SIZED)) * TILE_SIZED
val hby = (Terrarum.mouseTileY - floor((hitbox.height - 0.5) / TILE_SIZED)) * TILE_SIZED
hitbox.setPosition(hbx, hby)
}
}

View File

@@ -2,6 +2,9 @@ package net.torvald.terrarum.gameactors
import net.torvald.gdx.graphics.Cvec
/**
* Lightbox is defined based on pixelwise position in the world!
*/
class Lightbox() {
var hitbox: Hitbox = Hitbox(0.0,0.0,0.0,0.0)
var light: Cvec = Cvec()