diff --git a/src/net/torvald/terrarum/gameactors/ActorHumanoid.kt b/src/net/torvald/terrarum/gameactors/ActorHumanoid.kt index 92bc7fc2e..3f3d2591b 100644 --- a/src/net/torvald/terrarum/gameactors/ActorHumanoid.kt +++ b/src/net/torvald/terrarum/gameactors/ActorHumanoid.kt @@ -464,7 +464,7 @@ open class ActorHumanoid(birth: GameDate, death: GameDate? = null) return timedJumpCharge } - if (jumping) { + if (jumping) {// && jumpable) { // increment jump counter if (jumpCounter < len) jumpCounter += 1 @@ -472,8 +472,13 @@ open class ActorHumanoid(birth: GameDate, death: GameDate? = null) jumpAcc = pwr * timedJumpCharge * JUMP_ACCELERATION_MOD * Math.sqrt(scale) // positive value - applyForce(Vector2(0.0, -jumpAcc)) + walkY -= jumpAcc } + // not sure we need this... + /*else if (!jumpable) { + jumpable = true // this is kind of like "semaphore", we toggle it now + grounded = false // just in case... + }*/ // release "jump key" of AIs if (jumpCounter >= len && !isGamer) { diff --git a/src/net/torvald/terrarum/gameactors/ActorWithSprite.kt b/src/net/torvald/terrarum/gameactors/ActorWithSprite.kt index ad8bc8508..0952687d5 100644 --- a/src/net/torvald/terrarum/gameactors/ActorWithSprite.kt +++ b/src/net/torvald/terrarum/gameactors/ActorWithSprite.kt @@ -91,6 +91,8 @@ open class ActorWithSprite(renderOrder: ActorOrder, val immobileBody: Boolean = protected set(value) { controllerMoveDelta!!.y = value } + // not sure we need this... + //var jumpable = true // this is kind of like "semaphore" /** * Physical properties. @@ -587,12 +589,22 @@ open class ActorWithSprite(renderOrder: ActorOrder, val immobileBody: Boolean = * prevents sticking to the ceiling */ private fun hitAndForciblyReflectY() { + println("hitAndForciblyReflectY") // TODO HARK! I have changed veloX/Y to moveDelta.x/y if (moveDelta.y < 0) { - if (moveDelta.y.abs() * CEILING_HIT_ELASTICITY > A_PIXEL) + walkY = 0.0 + if (moveDelta.y * CEILING_HIT_ELASTICITY < -A_PIXEL) { moveDelta.y = -moveDelta.y * CEILING_HIT_ELASTICITY - else - moveDelta.y = moveDelta.y.sign() * -A_PIXEL + } + else { + moveDelta.y = A_PIXEL + } + + // for more of a "bounce", you can assign zero if you don't like it + externalForce.y = moveDelta.y * CEILING_HIT_ELASTICITY + //externalForce.y = 0.0 + + nextHitbox.translatePosY(0.5) } else { throw Error("Check this out bitch (moveDelta.y = ${moveDelta.y})")