mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 02:54:04 +09:00
fix: code for staircase climbing would interfere with hold-left/right-and-jump manoeuvre
This commit is contained in:
@@ -482,6 +482,8 @@ open class ActorHumanoid : ActorWithBody, Controllable, Pocketed, Factionable, L
|
||||
* @author minjaesong
|
||||
*/
|
||||
private fun walkHorizontal(left: Boolean, absAxisVal: Float) {
|
||||
// Heading flag
|
||||
walkHeading = if (left) LEFT else RIGHT
|
||||
|
||||
|
||||
if (avAcceleration.isNaN()) {
|
||||
@@ -489,30 +491,33 @@ open class ActorHumanoid : ActorWithBody, Controllable, Pocketed, Factionable, L
|
||||
}
|
||||
|
||||
|
||||
if (left && walledLeft || !left && walledRight) return
|
||||
if (left && walledLeft || !left && walledRight) {
|
||||
walkHStop()
|
||||
|
||||
controllerV?.x = 0.0
|
||||
}
|
||||
else {
|
||||
isWalkingH = true
|
||||
|
||||
readonly_totalX =
|
||||
readonly_totalX =
|
||||
if (absAxisVal == AXIS_KEYBOARD)
|
||||
avAcceleration * applyVelo(walkCounterX) * (if (left) -1f else 1f)
|
||||
else
|
||||
avAcceleration * applyVelo(walkCounterX) * (if (left) -1f else 1f) * absAxisVal
|
||||
|
||||
if (absAxisVal != AXIS_KEYBOARD)
|
||||
controllerV?.x?.let { controllerV!!.x = controllerV!!.x.plus(readonly_totalX).bipolarClamp(avSpeedCap * absAxisVal) }
|
||||
else
|
||||
controllerV?.x?.let { controllerV!!.x = controllerV!!.x.plus(readonly_totalX).bipolarClamp(avSpeedCap) }
|
||||
if (absAxisVal != AXIS_KEYBOARD)
|
||||
controllerV?.x?.let {
|
||||
controllerV!!.x = controllerV!!.x.plus(readonly_totalX).bipolarClamp(avSpeedCap * absAxisVal)
|
||||
}
|
||||
else
|
||||
controllerV?.x?.let { controllerV!!.x = controllerV!!.x.plus(readonly_totalX).bipolarClamp(avSpeedCap) }
|
||||
|
||||
if (walkCounterX <= WALK_FRAMES_TO_MAX_ACCEL) {
|
||||
walkCounterX += 1
|
||||
|
||||
if (walkCounterX <= WALK_FRAMES_TO_MAX_ACCEL) {
|
||||
walkCounterX += 1
|
||||
}
|
||||
}
|
||||
|
||||
isWalkingH = true
|
||||
|
||||
|
||||
|
||||
// Heading flag
|
||||
walkHeading = if (left) LEFT else RIGHT
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user