mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 11:34:05 +09:00
platform wip3
This commit is contained in:
@@ -1480,16 +1480,16 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
actorNowPlaying?.update(delta)*/
|
||||
}
|
||||
else {
|
||||
// Pass 1: update moving platforms first so riders get displaced before their own update
|
||||
// Pass 1: update contraptions first so riders get displaced before their own update
|
||||
actorContainerActive.forEach {
|
||||
if (it is ActorMovingPlatform && it != actorNowPlaying) {
|
||||
if (it is PhysContraption && it != actorNowPlaying) {
|
||||
it.update(delta)
|
||||
}
|
||||
}
|
||||
|
||||
// Pass 2: update all non-platform actors with existing callbacks
|
||||
// Pass 2: update all non-contraption actors with existing callbacks
|
||||
actorContainerActive.forEach {
|
||||
if (it !is ActorMovingPlatform && it != actorNowPlaying) {
|
||||
if (it !is PhysContraption && it != actorNowPlaying) {
|
||||
it.update(delta)
|
||||
|
||||
if (it is Pocketed) {
|
||||
|
||||
@@ -51,24 +51,24 @@ class ActorTestPlatform : ActorMovingPlatform(8) {
|
||||
// Horizontal pingpong: position = A * sin(phase)
|
||||
// Velocity = finite difference to prevent float drift
|
||||
val dx = amplitude * (sin(phase) - sin(oldPhase))
|
||||
platformVelocity.set(dx, 0.0)
|
||||
contraptionVelocity.set(dx, 0.0)
|
||||
}
|
||||
1 -> {
|
||||
// Vertical pingpong: position = A * sin(phase)
|
||||
val dy = amplitude * (sin(phase) - sin(oldPhase))
|
||||
platformVelocity.set(0.0, dy)
|
||||
contraptionVelocity.set(0.0, dy)
|
||||
}
|
||||
2 -> {
|
||||
// Clockwise circular: position on circle (cos, sin)
|
||||
val dx = amplitude * (cos(phase) - cos(oldPhase))
|
||||
val dy = amplitude * (sin(phase) - sin(oldPhase))
|
||||
platformVelocity.set(dx, dy)
|
||||
contraptionVelocity.set(dx, dy)
|
||||
}
|
||||
3 -> {
|
||||
// Counter-clockwise circular: negate Y component
|
||||
val dx = amplitude * (cos(phase) - cos(oldPhase))
|
||||
val dy = -(amplitude * (sin(phase) - sin(oldPhase)))
|
||||
platformVelocity.set(dx, dy)
|
||||
contraptionVelocity.set(dx, dy)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user