water jumping works but needs onscreen instruction to educate players

This commit is contained in:
minjaesong
2024-09-06 21:14:54 +09:00
parent bd8f455ce6
commit 1af82e4d5c
2 changed files with 9 additions and 7 deletions

View File

@@ -1501,8 +1501,8 @@ open class ActorWithBody : Actor {
// TODO reverse gravity
if (!straightGravity) TODO()
val itsY = (hitbox.startY / TILE_SIZED).toInt()
val iteY = (hitbox.endY / TILE_SIZED).toInt()
val itsY = ((hitbox.startY - PHYS_EPSILON_DIST) / TILE_SIZED).toInt()
val iteY = ((hitbox.endY - PHYS_EPSILON_DIST) / TILE_SIZED).toInt()
val txL = (hitbox.startX / TILE_SIZED).floorToInt()
val txR = (hitbox.endX / TILE_SIZED).floorToInt()
@@ -1622,9 +1622,11 @@ open class ActorWithBody : Actor {
private fun applyBuoyancy() {
if (world == null) return
val submergedRatioForOutOfWaterManoeuvre = submergedRatio.coerceAtLeast(PHYS_EPSILON_SUBMERSION_RATIO).pow(0.75)
// this term allows swimming. Model: you're opening a thruster pointing downwards
val jumpAcc = if (this is ActorHumanoid)
Vector2(0.0, swimAcc)
Vector2(0.0, if (submergedRatio >= PHYS_EPSILON_SUBMERSION_RATIO) (swimAcc / submergedRatioForOutOfWaterManoeuvre) else 0.0)
else
Vector2()
@@ -2238,6 +2240,7 @@ open class ActorWithBody : Actor {
@Transient const val PHYS_EPSILON_DIST = 1.0 / 4096.0
@Transient const val PHYS_EPSILON_VELO = 1.0 / 65536.0
@Transient const val PHYS_EPSILON_SUBMERSION_RATIO = 1.0 / 8.0
/**

View File

@@ -168,11 +168,10 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
// x: neither
(this.hitbox.endX >= WorldCamera.x && this.hitbox.startX <= WorldCamera.xEnd))
// Vchunks = (10 * Hchunks)^0.6, rounded towards nearest even number
val SIZE_SMALL = Point2i(CHUNK_W*67, CHUNK_H*50)
val SIZE_SMALL = Point2i(CHUNK_W*66, CHUNK_H*60)
val SIZE_NORMAL = Point2i(CHUNK_W*100, CHUNK_H*64)
val SIZE_LARGE = Point2i(CHUNK_W*150, CHUNK_H*80)
val SIZE_HUGE = Point2i(CHUNK_W*250, CHUNK_H*110) // world ratio: 4:3
val SIZE_LARGE = Point2i(CHUNK_W*150, CHUNK_H*66)
val SIZE_HUGE = Point2i(CHUNK_W*250, CHUNK_H*70)
val NEW_WORLD_SIZE = arrayOf(SIZE_SMALL, SIZE_NORMAL, SIZE_LARGE, SIZE_HUGE)
val WORLDPORTAL_NEW_WORLD_SIZE = arrayOf(SIZE_SMALL, SIZE_NORMAL, SIZE_LARGE, SIZE_HUGE)