var jump just pressed

This commit is contained in:
minjaesong
2019-10-06 14:50:16 +09:00
parent 02b67de91a
commit 951d9e0e71
3 changed files with 98 additions and 2 deletions

84
config_colemak.json Normal file
View File

@@ -0,0 +1,84 @@
{
"displayfps": 0,
"usevsync": false,
"screenwidth": 1110,
"screenheight": 740,
"language": "enUS",
"notificationshowuptime": 4000,
"multithread": true,
"multithreadedlight": false,
"showhealthmessageonstartup": true,
"usexinput": true,
"gamepadkeyn": 3,
"gamepadkeyw": 2,
"gamepadkeys": 0,
"gamepadkeye": 1,
"gamepadlup": 4,
"gamepadrup": 5,
"gamepadselect": 6,
"gamepadstart": 7,
"gamepadltrigger": 8,
"gamepadrtrigger": 9,
"gamepadlthumb": 10,
"gamepadrthumb": 11,
"gamepadaxislx": 1,
"gamepadaxisly": 0,
"gamepadaxisrx": 3,
"gamepadaxisry": 2,
"gamepadtriggeraxis": 4,
"gamepadtriggeraxis2": 5,
"gamepadaxiszeropoints": [
-0.011,
-0.022,
-0.033,
-0.044
],
"gamepadlabelstyle": "msxbone",
"keyup":34,
"keyleft":46,
"keydown":47,
"keyright":48,
"keyinventory":45,
"keyinteract":44,
"keymovementaux": 29,
"keyclose": 31,
"keyzoom": 54,
"keygamemenu": 61,
"keyquicksel": 59,
"keyquickselalt": [
67,
129,
73
],
"keyjump": 62,
"keyquickslots": [
8,
9,
10,
11,
12,
13,
14,
15,
16,
7
],
"mouseprimary": 0,
"mousesecondary": 1,
"pcgamepadenv": "console",
"maxparticles": 768,
"temperatureunit": 1,
"fxretro": false,
"buildingmakerfavs": [
148,
48,
50,
17,
19,
18,
176,
4144,
4146,
4244
]
}

View File

@@ -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

View File

@@ -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()}"
)
}