mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
wall-kick-jump WIP
This commit is contained in:
@@ -29,7 +29,7 @@ object AVKey {
|
||||
const val JUMPPOWER = "jumppower"
|
||||
const val JUMPPOWERBUFF = "$JUMPPOWER$BUFF"
|
||||
|
||||
/** How much air jumping you can perform. INT */
|
||||
/** How much air jumping you can perform. 0 is same as 1. INT */
|
||||
const val AIRJUMPPOINT = "airjumppoint"
|
||||
/** How much air jumping you have performed before you run out of the point. INT */
|
||||
const val AIRJUMPCOUNT = "_airjumpcount"
|
||||
|
||||
@@ -222,9 +222,10 @@ open class ActorWBMovable(renderOrder: RenderOrder, val immobileBody: Boolean =
|
||||
* [m / s^2]
|
||||
* s^2 = 1/FPS = 1/60 if FPS is targeted to 60
|
||||
* meter to pixel : 24/FPS
|
||||
*
|
||||
* NOTE: this property is "var" so that future coder can implement the "reverse gravity potion"
|
||||
*/
|
||||
private val gravitation: Vector2
|
||||
get() = world?.gravitation ?: Vector2(0.0, 9.8)
|
||||
var gravitation: Vector2 = world?.gravitation ?: GameWorld.DEFAULT_GRAVITATION
|
||||
@Transient val DRAG_COEFF_DEFAULT = 1.2
|
||||
/** Drag coefficient. Parachutes have much higher value than bare body (1.2) */
|
||||
var dragCoefficient: Double
|
||||
|
||||
@@ -83,7 +83,7 @@ open class GameWorld : Disposable {
|
||||
//public World physWorld = new World( new Vec2(0, -Terrarum.game.gravitationalAccel) );
|
||||
//physics
|
||||
/** Meter per second squared. Currently only the downward gravity is supported. No reverse gravity :p */
|
||||
open var gravitation: Vector2 = Vector2(0.0, 9.80665)
|
||||
open var gravitation: Vector2 = DEFAULT_GRAVITATION
|
||||
/** 0.0..1.0+ */
|
||||
open var globalLight = Cvec(0f, 0f, 0f, 0f)
|
||||
open var averageTemperature = 288f // 15 deg celsius; simulates global warming
|
||||
@@ -490,6 +490,8 @@ open class GameWorld : Disposable {
|
||||
|
||||
return nullWorldInstance!!
|
||||
}
|
||||
|
||||
val DEFAULT_GRAVITATION = Vector2(0.0, 9.8)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -162,6 +162,7 @@ open class ActorHumanoid(
|
||||
var isLeftDown = false; protected set
|
||||
var isRightDown = false; protected set
|
||||
var isJumpDown = false; protected set
|
||||
var isJumpJustDown = false; protected set // TODO if jump key is held in current update frame
|
||||
protected inline val isGamer: Boolean
|
||||
get() = if (Terrarum.ingame == null) false else this == Terrarum.ingame!!.actorNowPlaying
|
||||
|
||||
@@ -246,6 +247,8 @@ open class ActorHumanoid(
|
||||
isJumpDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("keyjump")) ||
|
||||
gamepad.getButton(AppLoader.getConfigInt("gamepadltrigger"))
|
||||
}
|
||||
|
||||
TODO("isJumpJustDown")
|
||||
}
|
||||
else {
|
||||
isUpDown = axisY < 0f
|
||||
@@ -347,16 +350,26 @@ open class ActorHumanoid(
|
||||
}
|
||||
|
||||
/**
|
||||
* Jump control
|
||||
* Jump-key control
|
||||
*/
|
||||
if (isJumpDown) {
|
||||
if (!isNoClip) {
|
||||
|
||||
// wall-kick jumps // (think of Mario DS!)
|
||||
|
||||
if (isJumpJustDown && !jumping && (walledLeft || walledRight)) {
|
||||
printdbg(this, "Wallkicking detection test print")
|
||||
}
|
||||
|
||||
// perpendicular jumps //
|
||||
|
||||
// make airjumping work by resetting some jump-related variables
|
||||
if (!playerJumpKeyHeldDown && (walledBottom || airJumpingCount < airJumpingPoint)) {
|
||||
jumping = true
|
||||
|
||||
// make airjumping work
|
||||
if (airJumpingCount < airJumpingPoint) {
|
||||
printdbg(this, "airjump!")
|
||||
//printdbg(this, "airjump!")
|
||||
// reset jumping-related variables
|
||||
jumpCounter = 0
|
||||
airJumpingCount += 1
|
||||
@@ -365,6 +378,8 @@ open class ActorHumanoid(
|
||||
//controllerV?.y = 0.0
|
||||
}
|
||||
}
|
||||
|
||||
// acutally launch the player in the air
|
||||
jump()
|
||||
}
|
||||
else {
|
||||
@@ -434,7 +449,7 @@ open class ActorHumanoid(
|
||||
else
|
||||
controllerV?.x?.let { controllerV!!.x = controllerV!!.x.plus(readonly_totalX).bipolarClamp(avSpeedCap) }
|
||||
|
||||
if (walkCounterX < 1000000) {
|
||||
if (walkCounterX <= WALK_FRAMES_TO_MAX_ACCEL) {
|
||||
walkCounterX += 1
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ object PlayerBuilderTestSubject1 {
|
||||
//p.actorValue[AVKey.LUMB] = 1.37
|
||||
//p.actorValue[AVKey.LUMA] = 1.93
|
||||
|
||||
p.actorValue[AVKey.AIRJUMPPOINT] = 2
|
||||
p.actorValue[AVKey.AIRJUMPPOINT] = 0
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
@@ -131,7 +131,9 @@ class BasicDebugInfoWindow : UICanvas() {
|
||||
"${if (player.walledBottom) "$ccR" else "$ccG"}${0x1F.toChar()}" +
|
||||
"${if (player.walledTop) "$ccR" else "$ccG"}${0x1E.toChar()}" +
|
||||
"${if (player.walledRight) "$ccR" else "$ccG"}R" +
|
||||
"${if (player.colliding) "$ccR" else "$ccG"}${0x08.toChar()}"
|
||||
"${if (player.colliding) "$ccR" else "$ccG"}${0x08.toChar()} " +
|
||||
"${if (player.jumping) "$ccG" else "$ccK"}JMP" +
|
||||
"${if (player.isJumpDown) "$ccG" else "$ccK"}KEY"
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user