mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-16 16:46:07 +09:00
water jumping works but needs onscreen instruction to educate players
This commit is contained in:
@@ -1501,8 +1501,8 @@ open class ActorWithBody : Actor {
|
|||||||
// TODO reverse gravity
|
// TODO reverse gravity
|
||||||
if (!straightGravity) TODO()
|
if (!straightGravity) TODO()
|
||||||
|
|
||||||
val itsY = (hitbox.startY / TILE_SIZED).toInt()
|
val itsY = ((hitbox.startY - PHYS_EPSILON_DIST) / TILE_SIZED).toInt()
|
||||||
val iteY = (hitbox.endY / TILE_SIZED).toInt()
|
val iteY = ((hitbox.endY - PHYS_EPSILON_DIST) / TILE_SIZED).toInt()
|
||||||
val txL = (hitbox.startX / TILE_SIZED).floorToInt()
|
val txL = (hitbox.startX / TILE_SIZED).floorToInt()
|
||||||
val txR = (hitbox.endX / TILE_SIZED).floorToInt()
|
val txR = (hitbox.endX / TILE_SIZED).floorToInt()
|
||||||
|
|
||||||
@@ -1622,9 +1622,11 @@ open class ActorWithBody : Actor {
|
|||||||
private fun applyBuoyancy() {
|
private fun applyBuoyancy() {
|
||||||
if (world == null) return
|
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
|
// this term allows swimming. Model: you're opening a thruster pointing downwards
|
||||||
val jumpAcc = if (this is ActorHumanoid)
|
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
|
else
|
||||||
Vector2()
|
Vector2()
|
||||||
|
|
||||||
@@ -2238,6 +2240,7 @@ open class ActorWithBody : Actor {
|
|||||||
|
|
||||||
@Transient const val PHYS_EPSILON_DIST = 1.0 / 4096.0
|
@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_VELO = 1.0 / 65536.0
|
||||||
|
@Transient const val PHYS_EPSILON_SUBMERSION_RATIO = 1.0 / 8.0
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -168,11 +168,10 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
|||||||
// x: neither
|
// x: neither
|
||||||
(this.hitbox.endX >= WorldCamera.x && this.hitbox.startX <= WorldCamera.xEnd))
|
(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*66, CHUNK_H*60)
|
||||||
val SIZE_SMALL = Point2i(CHUNK_W*67, CHUNK_H*50)
|
|
||||||
val SIZE_NORMAL = Point2i(CHUNK_W*100, CHUNK_H*64)
|
val SIZE_NORMAL = Point2i(CHUNK_W*100, CHUNK_H*64)
|
||||||
val SIZE_LARGE = Point2i(CHUNK_W*150, CHUNK_H*80)
|
val SIZE_LARGE = Point2i(CHUNK_W*150, CHUNK_H*66)
|
||||||
val SIZE_HUGE = Point2i(CHUNK_W*250, CHUNK_H*110) // world ratio: 4:3
|
val SIZE_HUGE = Point2i(CHUNK_W*250, CHUNK_H*70)
|
||||||
val NEW_WORLD_SIZE = arrayOf(SIZE_SMALL, SIZE_NORMAL, SIZE_LARGE, SIZE_HUGE)
|
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)
|
val WORLDPORTAL_NEW_WORLD_SIZE = arrayOf(SIZE_SMALL, SIZE_NORMAL, SIZE_LARGE, SIZE_HUGE)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user