mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-08 04:41:51 +09:00
var jump just pressed
This commit is contained in:
@@ -166,6 +166,7 @@ open class ActorHumanoid(
|
||||
protected inline val isGamer: Boolean
|
||||
get() = if (Terrarum.ingame == null) false else this == Terrarum.ingame!!.actorNowPlaying
|
||||
|
||||
private var jumpJustPressedLatched = false
|
||||
|
||||
@Transient private val nullItem = object : GameItem(0) {
|
||||
override val isUnique: Boolean = false
|
||||
@@ -248,7 +249,17 @@ open class ActorHumanoid(
|
||||
gamepad.getButton(AppLoader.getConfigInt("gamepadltrigger"))
|
||||
}
|
||||
|
||||
TODO("isJumpJustDown")
|
||||
if (isJumpJustDown && jumpJustPressedLatched) {
|
||||
isJumpJustDown = false
|
||||
}
|
||||
else if (isJumpDown && !jumpJustPressedLatched) {
|
||||
isJumpJustDown = true
|
||||
jumpJustPressedLatched = true
|
||||
}
|
||||
else if (!isJumpDown) {
|
||||
jumpJustPressedLatched = false
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
isUpDown = axisY < 0f
|
||||
|
||||
@@ -133,7 +133,8 @@ class BasicDebugInfoWindow : UICanvas() {
|
||||
"${if (player.walledRight) "$ccR" else "$ccG"}R" +
|
||||
"${if (player.colliding) "$ccR" else "$ccG"}${0x08.toChar()} " +
|
||||
"${if (player.jumping) "$ccG" else "$ccK"}JMP" +
|
||||
"${if (player.isJumpDown) "$ccG" else "$ccK"}KEY"
|
||||
"${if (player.isJumpDown) "$ccG" else "$ccK"}KEY" +
|
||||
"${if (player.isJumpJustDown) "$ccO" else "$ccK"}${0x0F.toChar()}"
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user