mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-13 03:54:06 +09:00
moving platform wip
This commit is contained in:
BIN
assets/mods/basegame/sprites/movables/test_platform.tga
LFS
Normal file
BIN
assets/mods/basegame/sprites/movables/test_platform.tga
LFS
Normal file
Binary file not shown.
@@ -0,0 +1,29 @@
|
|||||||
|
package net.torvald.terrarum.modulebasegame.gameactors
|
||||||
|
|
||||||
|
import net.torvald.terrarum.gameactors.ActorID
|
||||||
|
import net.torvald.terrarum.gameactors.ActorWithBody
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by minjaesong on 2022-02-28.
|
||||||
|
*/
|
||||||
|
class ActorMovingPlatform() : ActorWithBody() {
|
||||||
|
|
||||||
|
private val tilewiseLength = 3
|
||||||
|
|
||||||
|
private val actorsRiding = ArrayList<ActorID>() // saving actorID due to serialisation issues
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make the actor its externalV controlled by this platform
|
||||||
|
*/
|
||||||
|
fun mount(actor: ActorWithBody) {
|
||||||
|
actorsRiding.add(actor.referenceID)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make the actor its externalV no longer controlled by this platform
|
||||||
|
*/
|
||||||
|
fun dismount(actor: ActorWithBody) {
|
||||||
|
actorsRiding.remove(actor.referenceID)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -130,7 +130,10 @@ open class FixtureBase : ActorWithBody, CuedByTerrainChange {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasCollision) return false
|
if (hasCollision) {
|
||||||
|
printdbg(this, "cannot spawn fixture ${nameFun()}, has tile collision; tilewise dim: (${blockBox.width}, ${blockBox.height}) ")
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
printdbg(this, "spawn fixture ${nameFun()}, tilewise dim: (${blockBox.width}, ${blockBox.height})")
|
printdbg(this, "spawn fixture ${nameFun()}, tilewise dim: (${blockBox.width}, ${blockBox.height})")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user