fix: setHitboxDimension had no instruction whatsoever for the fixtures

This commit is contained in:
minjaesong
2024-01-11 01:51:06 +09:00
parent 6e32647e6d
commit 52ae1768cb
4 changed files with 6 additions and 4 deletions

View File

@@ -37,7 +37,7 @@ class FixtureHomeComputer : FixtureBase {
nameFun = { "Computer" }
) {
density = 1400.0
setHitboxDimension(TerrarumAppConfiguration.TILE_SIZE, TerrarumAppConfiguration.TILE_SIZE, 0, -1)
setHitboxDimension(TerrarumAppConfiguration.TILE_SIZE, TerrarumAppConfiguration.TILE_SIZE, 0, 0)
makeNewSprite(FixtureBase.getSpritesheet("dwarventech", "sprites/fixtures/desktop_computer.tga", TILE_SIZE, TILE_SIZE)).let {
it.setRowsAndFrames(1,1)

View File

@@ -419,6 +419,8 @@ open class ActorWithBody : Actor {
/**
* ONLY FOR INITIAL SETUP
*
* For the fixtures, `ty` of `0` will plant the fixture to the ground (they will spawn 1 px lower). Use value `1` to spawn them flush to the block grids.
*
* @param w
* @param h
* @param tx positive: translate sprite to LEFT.
@@ -428,7 +430,7 @@ open class ActorWithBody : Actor {
baseHitboxH = h
baseHitboxW = w
hitboxTranslateX = tx
hitboxTranslateY = ty
hitboxTranslateY = ty - 1 // plant the fixture to the ground
hitbox.setDimension(w.toDouble(), h.toDouble())
}

View File

@@ -127,7 +127,7 @@ open class FixtureSwingingDoorBase : FixtureBase {
(if (isOpacityActuallyLuminosity) lightBoxList else shadeBoxList)[0].light = opacity
// define physical size
setHitboxDimension(TILE_SIZE * tilewiseHitboxWidth, TILE_SIZE * tilewiseHitboxHeight, 0, 0)
setHitboxDimension(TILE_SIZE * tilewiseHitboxWidth, TILE_SIZE * tilewiseHitboxHeight, 0, 1)
blockBox = BlockBox(BlockBox.FULL_COLLISION, tilewiseHitboxWidth, tilewiseHitboxHeight)
doorHoldLength = hashMapOf(

View File

@@ -23,7 +23,7 @@ class FixtureWallCalendar : FixtureBase {
val itemImage = FixtureItemBase.getItemImageFromSingleImage("basegame", "sprites/fixtures/calendar.tga")
density = 600.0
setHitboxDimension(TILE_SIZE, TILE_SIZE, 0, 0)
setHitboxDimension(TILE_SIZE, TILE_SIZE, 0, 1)
makeNewSprite(TextureRegionPack(itemImage.texture, TILE_SIZE, TILE_SIZE)).let {
it.setRowsAndFrames(1,1)