mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-12 06:41:51 +09:00
platform going down with Down button on keeb
This commit is contained in:
@@ -12,6 +12,7 @@ import net.torvald.terrarum.blockproperties.BlockProp
|
|||||||
import net.torvald.terrarum.gamecontroller.KeyToggler
|
import net.torvald.terrarum.gamecontroller.KeyToggler
|
||||||
import net.torvald.terrarum.gameworld.BlockAddress
|
import net.torvald.terrarum.gameworld.BlockAddress
|
||||||
import net.torvald.terrarum.gameworld.GameWorld
|
import net.torvald.terrarum.gameworld.GameWorld
|
||||||
|
import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid
|
||||||
import net.torvald.terrarum.realestate.LandUtil
|
import net.torvald.terrarum.realestate.LandUtil
|
||||||
import net.torvald.terrarum.worlddrawer.FeaturesDrawer
|
import net.torvald.terrarum.worlddrawer.FeaturesDrawer
|
||||||
import net.torvald.terrarum.worlddrawer.WorldCamera
|
import net.torvald.terrarum.worlddrawer.WorldCamera
|
||||||
@@ -967,8 +968,15 @@ open class ActorWBMovable(renderOrder: RenderOrder, val immobileBody: Boolean =
|
|||||||
private fun shouldICollideWithThis(tile: Int) =
|
private fun shouldICollideWithThis(tile: Int) =
|
||||||
// regular solid block
|
// regular solid block
|
||||||
(BlockCodex[tile].isSolid) ||
|
(BlockCodex[tile].isSolid) ||
|
||||||
// platforms and their necessary conditionals
|
// platforms, moving downward AND not "going down"
|
||||||
(BlockCodex[tile].isPlatform && externalForce.y + (controllerMoveDelta?.y ?: 0.0) >= 0.0)
|
(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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ import net.torvald.terrarum.itemproperties.GameItem
|
|||||||
import net.torvald.terrarum.itemproperties.Material
|
import net.torvald.terrarum.itemproperties.Material
|
||||||
import net.torvald.terrarum.modulebasegame.Ingame
|
import net.torvald.terrarum.modulebasegame.Ingame
|
||||||
import net.torvald.terrarum.modulebasegame.gameworld.time_t
|
import net.torvald.terrarum.modulebasegame.gameworld.time_t
|
||||||
import net.torvald.terrarum.realestate.LandUtil
|
|
||||||
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull
|
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull
|
||||||
|
import net.torvald.terrarum.realestate.LandUtil
|
||||||
import net.torvald.terrarum.worlddrawer.LightmapRenderer
|
import net.torvald.terrarum.worlddrawer.LightmapRenderer
|
||||||
import org.dyn4j.geometry.Vector2
|
import org.dyn4j.geometry.Vector2
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@@ -105,10 +105,10 @@ open class ActorHumanoid(
|
|||||||
// MOVEMENT RELATED FUNCTIONS //
|
// MOVEMENT RELATED FUNCTIONS //
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
var axisX = 0f
|
var axisX = 0f; protected set
|
||||||
var axisY = 0f
|
var axisY = 0f; protected set
|
||||||
var axisRX = 0f
|
var axisRX = 0f; protected set
|
||||||
var axisRY = 0f
|
var axisRY = 0f; protected set
|
||||||
|
|
||||||
/** empirical value. */
|
/** empirical value. */
|
||||||
@Transient private val JUMP_ACCELERATION_MOD = 51.0 / 10000.0 // (170 * (17/MAX_JUMP_LENGTH)^2) / 10000.0
|
@Transient private val JUMP_ACCELERATION_MOD = 51.0 / 10000.0 // (170 * (17/MAX_JUMP_LENGTH)^2) / 10000.0
|
||||||
@@ -141,11 +141,11 @@ open class ActorHumanoid(
|
|||||||
@Transient private val AXIS_KEYBOARD = -13372f // leetz
|
@Transient private val AXIS_KEYBOARD = -13372f // leetz
|
||||||
@Transient private val GAMEPAD_JUMP = 7
|
@Transient private val GAMEPAD_JUMP = 7
|
||||||
|
|
||||||
protected var isUpDown = false
|
var isUpDown = false; protected set
|
||||||
protected var isDownDown = false
|
var isDownDown = false; protected set
|
||||||
protected var isLeftDown = false
|
var isLeftDown = false; protected set
|
||||||
protected var isRightDown = false
|
var isRightDown = false; protected set
|
||||||
protected var isJumpDown = false
|
var isJumpDown = false; protected set
|
||||||
protected inline val isGamer: Boolean
|
protected inline val isGamer: Boolean
|
||||||
get() = if (Terrarum.ingame == null) false else this == Terrarum.ingame!!.actorNowPlaying
|
get() = if (Terrarum.ingame == null) false else this == Terrarum.ingame!!.actorNowPlaying
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user