dunno why but setting camera position to negative works...

This commit is contained in:
minjaesong
2017-07-03 23:42:59 +09:00
parent b7fb8ff4da
commit 7b2b6caf82
10 changed files with 112 additions and 72 deletions

View File

@@ -14,7 +14,7 @@ class Hitbox(x1: Double, y1: Double, width: Double, height: Double) {
@Volatile var hitboxStart: Point2d
private set
val hitboxEnd: Point2d
inline val hitboxEnd: Point2d
get() = Point2d(hitboxStart.x + width, hitboxStart.y + height)
var width: Double = 0.0
private set
@@ -135,4 +135,8 @@ class Hitbox(x1: Double, y1: Double, width: Double, height: Double) {
operator fun minus(other: Hitbox): Vector2 {
return Vector2(other.centeredX - this.centeredX, other.centeredY - this.centeredY)
}
override fun equals(other: Any?): Boolean {
return this.hitboxStart == (other as Hitbox).hitboxStart && this.hitboxEnd == (other as Hitbox).hitboxEnd
}
}

View File

@@ -1,5 +1,7 @@
package net.torvald.terrarum.gameactors
import net.torvald.terrarum.worlddrawer.LightmapRenderer
/**
* A wrapper to support instant player changing (or possessing other NPCs maybe)
*
@@ -13,4 +15,17 @@ class PlayableActorDelegate(val actor: ActorHumanoid) {
throw IllegalArgumentException("Player must be 'Controllable'!")
}
fun update(delta: Float) {
//val oldTilewisePos = actor.tilewiseHitbox
actor.update(delta)
// fire lightmap recalculate event upon tilewise pos change
//val newTilewisePos = actor.tilewiseHitbox
//if (oldTilewisePos != newTilewisePos) {
// LightmapRenderer.fireRecalculateEvent()
//}
// not going to work: think about stationery tiki torches, global lights, etc
}
}

View File

@@ -32,7 +32,7 @@ object PlayerBuilderSigrid {
p.actorValue[AVKey.SPEEDBUFF] = 1.0
p.actorValue[AVKey.ACCEL] = ActorHumanoid.WALK_ACCEL_BASE
p.actorValue[AVKey.ACCELBUFF] = 1.0
p.actorValue[AVKey.JUMPPOWER] = 9.0
p.actorValue[AVKey.JUMPPOWER] = 8.0
p.actorValue[AVKey.BASEMASS] = 80.0
p.actorValue[AVKey.SCALEBUFF] = 1.0 // Constant 1.0 for player, meant to be used by random mobs