mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-17 05:54:05 +09:00
lightning bolt WIP, player sprite declaration macro
Former-commit-id: d4999cda37bff2aa27615183aa125bfbc8cfa975 Former-commit-id: 224aee51d4fb7e5fe9d11bf3c0cc758a5604251d
This commit is contained in:
@@ -23,8 +23,8 @@ open class ActorWithBody : Actor(), Visible {
|
||||
override var referenceID: Int = generateUniqueReferenceID()
|
||||
override var actorValue: ActorValue = ActorValue()
|
||||
|
||||
@Transient var sprite: SpriteAnimation? = null
|
||||
@Transient var spriteGlow: SpriteAnimation? = null
|
||||
@Transient internal var sprite: SpriteAnimation? = null
|
||||
@Transient internal var spriteGlow: SpriteAnimation? = null
|
||||
|
||||
@Transient private val world: GameWorld = Terrarum.ingame.world
|
||||
|
||||
@@ -229,6 +229,16 @@ open class ActorWithBody : Actor(), Visible {
|
||||
// some initialiser goes here...
|
||||
}
|
||||
|
||||
fun makeNewSprite(w: Int, h: Int) {
|
||||
sprite = SpriteAnimation()
|
||||
sprite!!.setDimension(w, h)
|
||||
}
|
||||
|
||||
fun makeNewSpriteGlow(w: Int, h: Int) {
|
||||
spriteGlow = SpriteAnimation()
|
||||
spriteGlow!!.setDimension(w, h)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param w
|
||||
* @param h
|
||||
@@ -1016,6 +1026,7 @@ fun Double.roundInt(): Int = Math.round(this).toInt()
|
||||
fun Float.roundInt(): Int = Math.round(this).toInt()
|
||||
fun Double.abs() = Math.abs(this)
|
||||
fun Double.sqr() = this * this
|
||||
fun Double.sqrt() = Math.sqrt(this)
|
||||
fun Int.abs() = if (this < 0) -this else this
|
||||
fun Double.bipolarClamp(limit: Double) =
|
||||
if (this > 0 && this > limit) limit
|
||||
|
||||
@@ -17,8 +17,7 @@ object PlayerBuilderCynthia {
|
||||
p.actorValue["__selectedtile"] = 16
|
||||
|
||||
|
||||
p.sprite = SpriteAnimation()
|
||||
p.sprite!!.setDimension(26, 42)
|
||||
p.makeNewSprite(26, 42)
|
||||
p.sprite!!.setSpriteImage("assets/graphics/sprites/test_player_2.png")
|
||||
p.sprite!!.setDelay(200)
|
||||
p.sprite!!.setRowsAndFrames(1, 1)
|
||||
|
||||
@@ -21,15 +21,13 @@ object PlayerBuilderSigrid {
|
||||
|
||||
p.referenceID = 0x51621D // the only constant of this procedural universe
|
||||
|
||||
p.sprite = SpriteAnimation()
|
||||
p.sprite!!.setDimension(28, 51)
|
||||
p.makeNewSprite(28, 51)
|
||||
p.sprite!!.setSpriteImage("assets/graphics/sprites/test_player.png")
|
||||
p.sprite!!.setDelay(200)
|
||||
p.sprite!!.setRowsAndFrames(1, 1)
|
||||
p.sprite!!.setAsVisible()
|
||||
|
||||
p.spriteGlow = SpriteAnimation()
|
||||
p.spriteGlow!!.setDimension(28, 51)
|
||||
p.makeNewSpriteGlow(28, 51)
|
||||
p.spriteGlow!!.setSpriteImage("assets/graphics/sprites/test_player_glow.png")
|
||||
p.spriteGlow!!.setDelay(200)
|
||||
p.spriteGlow!!.setRowsAndFrames(1, 1)
|
||||
|
||||
Reference in New Issue
Block a user