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:
minjaesong
2018-10-01 23:51:04 +09:00
parent 03b642ddd3
commit 98539e698f
25 changed files with 341 additions and 226 deletions

View File

@@ -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")