get player head texture wip

This commit is contained in:
minjaesong
2021-12-20 22:56:16 +09:00
parent 07345e3128
commit 099071bdd0
18 changed files with 431 additions and 40 deletions

View File

@@ -3,6 +3,7 @@ package net.torvald.terrarum.gameactors
import com.badlogic.gdx.Input
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.graphics.g2d.TextureRegion
import net.torvald.spriteanimation.SpriteAnimation
import net.torvald.terrarum.*
import net.torvald.terrarum.App.printdbg
@@ -1726,6 +1727,10 @@ open class ActorWithBody : Actor {
flagDespawn = true
}
open fun getSpriteHead(): TextureRegion? {
return sprite?.textureRegion?.get(0,0)
}
private fun forEachOccupyingTileNum(consumer: (ItemID?) -> Unit) {
if (world == null) return
@@ -1908,12 +1913,15 @@ inline fun drawBodyInGoodPosition(startX: Float, startY: Float, drawFun: (x: Flo
val offendingPad2 = WorldCamera.width + 1
if (WorldCamera.x >= offendingPad && startX < WorldCamera.width) {
// App.batch.color = Color.RED
drawFun(startX + INGAME.world.width * TILE_SIZEF, startY)
}
// else if (WorldCamera.x <= offendingPad2 && startX > offendingPad) {
// drawFun(startX - INGAME.world.width * TILE_SIZEF, startY)
// }
else if (WorldCamera.x <= offendingPad2 && startX > offendingPad) {
// App.batch.color = Color.BLUE
drawFun(startX - INGAME.world.width * TILE_SIZEF, startY)
}
else {
// App.batch.color = Color.WHITE
drawFun(startX , startY)
}
}

View File

@@ -64,7 +64,6 @@ class WireActor : ActorWithBody {
}
}
sprite!!.currentFrame = ret
sprite!!.flipVertical = true // turns out the sprites are rendered upside-down by default :(
}
private fun getNearbyTilesPos(x: Int, y: Int): Array<Point2i> {