platform going down with Down button on keeb

This commit is contained in:
Minjae Song
2018-12-30 20:17:28 +09:00
parent 48de42d98b
commit cd13e04658
2 changed files with 20 additions and 12 deletions

View File

@@ -12,6 +12,7 @@ import net.torvald.terrarum.blockproperties.BlockProp
import net.torvald.terrarum.gamecontroller.KeyToggler
import net.torvald.terrarum.gameworld.BlockAddress
import net.torvald.terrarum.gameworld.GameWorld
import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid
import net.torvald.terrarum.realestate.LandUtil
import net.torvald.terrarum.worlddrawer.FeaturesDrawer
import net.torvald.terrarum.worlddrawer.WorldCamera
@@ -967,8 +968,15 @@ open class ActorWBMovable(renderOrder: RenderOrder, val immobileBody: Boolean =
private fun shouldICollideWithThis(tile: Int) =
// regular solid block
(BlockCodex[tile].isSolid) ||
// platforms and their necessary conditionals
(BlockCodex[tile].isPlatform && externalForce.y + (controllerMoveDelta?.y ?: 0.0) >= 0.0)
// platforms, moving downward AND not "going down"
(this is ActorHumanoid && BlockCodex[tile].isPlatform &&
externalForce.y + (controllerMoveDelta?.y ?: 0.0) >= 0.0 &&
!this.isDownDown && this.axisY <= 0f) ||
// platforms, moving downward
(this !is ActorHumanoid && BlockCodex[tile].isPlatform &&
externalForce.y + (controllerMoveDelta?.y ?: 0.0) >= 0.0)
// TODO: as for the platform, only apply it when it's a feet tile