mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-18 22:44:04 +09:00
minor edits
Former-commit-id: 727c880ff913f72cf17f89155c35966f38224c07 Former-commit-id: 65d4bf1045440de7d23efd3ef43176e1cddfa1e4
This commit is contained in:
@@ -29,7 +29,7 @@ open class ActorWithBody : Actor() {
|
||||
@Transient internal var sprite: SpriteAnimation? = null
|
||||
@Transient internal var spriteGlow: SpriteAnimation? = null
|
||||
|
||||
protected var drawMode: DrawMode = DrawMode.NORMAL
|
||||
var drawMode = BLEND_NORMAL
|
||||
|
||||
@Transient private val world: GameWorld = Terrarum.ingame.world
|
||||
|
||||
@@ -211,10 +211,7 @@ open class ActorWithBody : Actor() {
|
||||
|
||||
@Transient internal val BASE_FRICTION = 0.3
|
||||
|
||||
@Transient val KINEMATIC = 1 // does not displaced by external forces
|
||||
@Transient val DYNAMIC = 2 // displaced by external forces
|
||||
@Transient val STATIC = 3 // does not displaced by external forces, target of collision
|
||||
var collisionType = DYNAMIC
|
||||
var collisionType = COLLISION_DYNAMIC
|
||||
|
||||
@Transient private val CCD_TICK = 1.0 / 16.0
|
||||
@Transient private val CCD_TRY_MAX = 12800
|
||||
@@ -935,9 +932,9 @@ open class ActorWithBody : Actor() {
|
||||
open fun drawBody(gc: GameContainer, g: Graphics) {
|
||||
if (isVisible && sprite != null) {
|
||||
when (drawMode) {
|
||||
DrawMode.NORMAL -> blendNormal()
|
||||
DrawMode.MULTIPLY -> blendMul()
|
||||
DrawMode.SCREEN -> blendScreen()
|
||||
BLEND_NORMAL -> blendNormal()
|
||||
BLEND_MULTIPLY -> blendMul()
|
||||
BLEND_SCREEN -> blendScreen()
|
||||
}
|
||||
|
||||
if (!sprite!!.flippedHorizontal()) {
|
||||
@@ -1080,6 +1077,16 @@ open class ActorWithBody : Actor() {
|
||||
|
||||
companion object {
|
||||
|
||||
/**
|
||||
* Enumerations that exported to JSON
|
||||
*/
|
||||
@Transient const val COLLISION_KINEMATIC = 1 // does not displaced by external forces
|
||||
@Transient const val COLLISION_DYNAMIC = 2 // displaced by external forces
|
||||
@Transient const val COLLISION_STATIC = 3 // does not displaced by external forces, target of collision
|
||||
@Transient const val BLEND_NORMAL = 4
|
||||
@Transient const val BLEND_SCREEN = 5
|
||||
@Transient const val BLEND_MULTIPLY = 6
|
||||
|
||||
@Transient private val TILE_SIZE = MapDrawer.TILE_SIZE
|
||||
|
||||
private fun div16TruncateToMapWidth(x: Int): Int {
|
||||
@@ -1140,7 +1147,3 @@ fun absMax(left: Double, right: Double): Double {
|
||||
|
||||
fun Double.magnSqr() = if (this >= 0.0) this.sqr() else -this.sqr()
|
||||
fun Double.sign() = if (this > 0.0) 1.0 else if (this < 0.0) -1.0 else 0.0
|
||||
|
||||
enum class DrawMode {
|
||||
NORMAL, SCREEN, MULTIPLY
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class Player(born: GameDate) : ActorHumanoid(born) {
|
||||
isVisible = true
|
||||
referenceID = PLAYER_REF_ID // forcibly set ID
|
||||
density = BASE_DENSITY
|
||||
collisionType = KINEMATIC
|
||||
collisionType = COLLISION_KINEMATIC
|
||||
|
||||
try {
|
||||
gamepad = Controllers.getController(0)
|
||||
|
||||
@@ -63,7 +63,7 @@ open class ProjectileSimple(
|
||||
|
||||
|
||||
|
||||
collisionType = KINEMATIC
|
||||
collisionType = COLLISION_KINEMATIC
|
||||
}
|
||||
|
||||
override fun update(gc: GameContainer, delta: Int) {
|
||||
|
||||
Reference in New Issue
Block a user