mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-15 21:14:04 +09:00
World Click events
let's hope it works w/o tests as I can't get to the Ingame now
This commit is contained in:
@@ -507,11 +507,21 @@ open class ActorWBMovable(val world: GameWorld, renderOrder: RenderOrder, val im
|
||||
*/
|
||||
val D: Vector2 = Vector2(externalForce.x.magnSqr(), externalForce.y.magnSqr()) * dragCoefficient * 0.5 * A// * tileDensityFluid.toDouble()
|
||||
|
||||
val V: Vector2 = (W - D) / Terrarum.TARGET_FPS.toDouble() * SI_TO_GAME_ACC
|
||||
val V: Vector2 = (W - D) / Terrarum.TARGET_FPS * SI_TO_GAME_ACC
|
||||
|
||||
return V
|
||||
}
|
||||
|
||||
/**
|
||||
* Event for collision (event gets fired when it collided with the world or other actors)
|
||||
*
|
||||
* This event may fired two or more times per update.
|
||||
*/
|
||||
open fun collided(other: Array<CollisionMessage>) {
|
||||
}
|
||||
|
||||
data class CollisionMessage(val targetID: Int, val AkspfisWorld: Boolean)
|
||||
|
||||
/**
|
||||
* Apply gravitation to the every falling body (unless not levitating)
|
||||
*
|
||||
@@ -663,6 +673,14 @@ open class ActorWBMovable(val world: GameWorld, renderOrder: RenderOrder, val im
|
||||
2, 7 -> { newHitbox.translatePosY( - newHitbox.endY.modTileDelta()) ; bounceY = true }
|
||||
}
|
||||
|
||||
|
||||
// fire Collision Event with one/two/three-side collision
|
||||
// for the ease of writing, this jumptable is separated from above.
|
||||
when (selfCollisionStatus) {
|
||||
// TODO compose CollisionInfo and fire collided()
|
||||
}
|
||||
|
||||
|
||||
// two-side collision
|
||||
if (selfCollisionStatus in listOf(3,6,9,12)) {
|
||||
debug1("twoside collision $selfCollisionStatus")
|
||||
|
||||
Reference in New Issue
Block a user