blockprop: fall is now grav

This commit is contained in:
minjaesong
2019-06-11 20:55:28 +09:00
parent 196ae40bbb
commit 23b103892e
11 changed files with 139 additions and 137 deletions

View File

@@ -80,10 +80,8 @@ open class FixtureBase(blockBox0: BlockBox, val blockBoxProps: BlockBoxProps = B
// set the position of this actor
worldBlockPos = Point2i(posX, posY)
val posXoff = (TSIZE % (this.sprite?.cellWidth ?: 0)) / 2
this.isVisible = true
this.hitbox.setFromWidthHeight(posX * TSIZE + posXoff, posY * TSIZE, blockBox.width * TSIZE, blockBox.height * TSIZE)
this.hitbox.setFromWidthHeight(posX * TSIZE, posY * TSIZE, blockBox.width * TSIZE, blockBox.height * TSIZE)
// actually add this actor into the world
Terrarum.ingame!!.addNewActor(this)

View File

@@ -26,10 +26,10 @@ internal class FixtureTikiTorch : FixtureBase(BlockBox(BlockBox.NO_COLLISION, 1,
init {
density = 1200.0
setHitboxDimension(10, 24, 0, 0)
setHitboxDimension(16, 32, 0, 0)
lightBoxList = ArrayList(1)
lightBoxList.add(Hitbox(3.0, 0.0, 4.0, 3.0))
lightBoxList.add(Hitbox(6.0, 5.0, 4.0, 3.0))
makeNewSprite(TextureRegionPack(ModMgr.getGdxFile("basegame", "sprites/fixtures/tiki_torch.tga"), 10, 27))
sprite!!.setRowsAndFrames(1, 1)

View File

@@ -254,7 +254,7 @@ object WorldSimulator {
val tile = world.getTileFromTerrain(x, y) ?: Block.STONE
val tileBelow = world.getTileFromTerrain(x, y + 1) ?: Block.STONE
if (tile.isFallable()) {
if (tile.maxSupport()) {
// displace fluid. This statement must precede isSolid()
if (tileBelow.isFluid()) {
// remove tileThis to create air pocket
@@ -316,7 +316,7 @@ object WorldSimulator {
}
fun Int.isFallable() = BlockCodex[this].isFallable
fun Int.isFallable() = BlockCodex[this].maxSupport