the new sprite fully assembled

This commit is contained in:
minjaesong
2021-07-07 16:52:07 +09:00
parent 567fe668dc
commit 0fa395acd5
15 changed files with 173 additions and 6 deletions

View File

@@ -0,0 +1,37 @@
# complete file name is: SPRITESHEET + bodypart name + EXTENSION
SPRITESHEET=mods/basegame/sprites/test_werebeast/taimu_
EXTENSION=.tga
# defines frame size and origin point. Origin point is given as: (originx, size.y - 1)
# ORIGINY is deduced from the sprite size as shown in above; you only need to set ORIGINX
CONFIG=SIZE 64,98;ORIGINX 40
# note to self: don't implement skeleton hierarchy: there's too many exceptions
# besides, you have "ALL" key.
! a skeleton also defines what body parts (images) be used.
! you can also write multiline text using reverse solidus; this is a feature of .properties
! skeleton joints are ordered: foremost-drawn object comes first, which means lowermost object IN THIS LIST
! are painted first, and any object that comes before it will paint over it. In other words, this list is
! first reversed then being iterated.
! Joints' original point is defined in the document sprite_joints.psd. It also has visual representations.
# TODO right now accessory points are explicitly defined. Should they be injected in run-time?
SKELETON_STAND=HEADGEAR 0,32;\
ARM_REST_LEFT -8,49;HELD_ITEM -6,11;\
HEAD 2,83;\
LEG_REST_RIGHT -4,21;\
LEG_REST_LEFT 7,21;\
TORSO_0 0,57;\
TORSO_1 0,57;\
ARM_REST_RIGHT 11,51;\
TAIL_0 -11,27
# skeleton_stand is used for testing purpose
ANIM_RUN=DELAY 0.3;ROW 2;SKELETON SKELETON_STAND
ANIM_RUN_1=LEG_REST_RIGHT 2,2;LEG_REST_LEFT -2,0;TAIL_0 -1,0
ANIM_RUN_2=ALL 0,2;LEG_REST_RIGHT 0,-2;LEG_REST_LEFT 0,2;TAIL_0 1,0
ANIM_RUN_3=LEG_REST_RIGHT -2,0;LEG_REST_LEFT 2,2;TAIL_0 1,0
ANIM_RUN_4=ALL 0,2;LEG_REST_RIGHT 0,2;LEG_REST_LEFT 0,-2;TAIL_0 -1,0
ANIM_IDLE=DELAY 2;ROW 1;SKELETON SKELETON_STAND
ANIM_IDLE_1=TORSO_1 0,-999;HEAD 0,-1
ANIM_IDLE_2=TORSO_0 0,-999;ARM_REST_LEFT 0,1;ARM_REST_RIGHT 0,1

View File

@@ -0,0 +1,37 @@
# complete file name is: SPRITESHEET + bodypart name + EXTENSION
SPRITESHEET=mods/basegame/sprites/test_werebeast/taimu_
EXTENSION=.tga
# defines frame size and origin point. Origin point is given as: (originx, size.y - 1)
# ORIGINY is deduced from the sprite size as shown in above; you only need to set ORIGINX
CONFIG=SIZE 64,98;ORIGINX 40
# note to self: don't implement skeleton hierarchy: there's too many exceptions
# besides, you have "ALL" key.
! a skeleton also defines what body parts (images) be used.
! you can also write multiline text using reverse solidus; this is a feature of .properties
! skeleton joints are ordered: foremost-drawn object comes first, which means lowermost object IN THIS LIST
! are painted first, and any object that comes before it will paint over it. In other words, this list is
! first reversed then being iterated.
! Joints' original point is defined in the document sprite_joints.psd. It also has visual representations.
# TODO right now accessory points are explicitly defined. Should they be injected in run-time?
SKELETON_STAND=HEADGEAR 0,32;\
ARM_REST_LEFT -8,49;HELD_ITEM -6,11;\
HEAD 2,83;\
LEG_REST_RIGHT -4,21;\
LEG_REST_LEFT 7,21;\
TORSO_0 0,57;\
TORSO_1 0,57;\
ARM_REST_RIGHT 11,51;\
TAIL_0 -11,27
# skeleton_stand is used for testing purpose
ANIM_RUN=DELAY 0.3;ROW 2;SKELETON SKELETON_STAND
ANIM_RUN_1=LEG_REST_RIGHT 2,2;LEG_REST_LEFT -2,0;TAIL_0 -1,0
ANIM_RUN_2=ALL 0,2;LEG_REST_RIGHT 0,-2;LEG_REST_LEFT 0,2;TAIL_0 1,0
ANIM_RUN_3=LEG_REST_RIGHT -2,0;LEG_REST_LEFT 2,2;TAIL_0 1,0
ANIM_RUN_4=ALL 0,2;LEG_REST_RIGHT 0,2;LEG_REST_LEFT 0,-2;TAIL_0 -1,0
ANIM_IDLE=DELAY 2;ROW 1;SKELETON SKELETON_STAND
ANIM_IDLE_1=TORSO_1 0,-999;HEAD 0,-1
ANIM_IDLE_2=TORSO_0 0,-999;ARM_REST_LEFT 0,1;ARM_REST_RIGHT 0,1

Binary file not shown.

Binary file not shown.

View File

@@ -284,7 +284,7 @@ class SpriteAssemblerPreview: Game() {
batch.inUse {
batch.color = Color.WHITE
batch.draw(renderTexture, 0f, 0f)
batch.draw(renderTexture, 0f, 0f, renderTexture.width * 2f, renderTexture.height * 2f)
}
}
@@ -310,9 +310,9 @@ class SpriteAssemblerPreview: Game() {
fun main(args: Array<String>) {
val appConfig = LwjglApplicationConfiguration()
appConfig.resizable = true
appConfig.resizable = false
appConfig.width = 512
appConfig.height = 512
appConfig.height = 1024
appConfig.foregroundFPS = 5
appConfig.backgroundFPS = 5

View File

@@ -289,7 +289,8 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
/** Load rest of the game with GL context */
fun postInit() {
//setTheRealGamerFirstTime(PlayerBuilderSigrid())
setTheRealGamerFirstTime(PlayerBuilderTestSubject1())
//setTheRealGamerFirstTime(PlayerBuilderTestSubject1())
setTheRealGamerFirstTime(PlayerBuilderWerebeastTest())

View File

@@ -0,0 +1,65 @@
package net.torvald.terrarum.modulebasegame.gameactors
import net.torvald.spriteanimation.SpriteAnimation
import net.torvald.terrarum.ModMgr
import net.torvald.terrarum.gameactors.AVKey
import net.torvald.terrarum.worlddrawer.CreateTileAtlas
/**
* Created by minjaesong on 2021-07-07.
*/
object PlayerBuilderWerebeastTest {
operator fun invoke(): IngamePlayer {
val p: IngamePlayer = IngamePlayer(
ModMgr.getPath("basegame", "sprites/taimu.properties"),
ModMgr.getPath("basegame", "sprites/taimu_glow.properties"),
-589141658L // random value thrown
)
//InjectCreatureRaw(p.actorValue, "basegame", "CreatureHuman.json")
p.actorValue[AVKey.SCALE] = 1.0
p.actorValue[AVKey.SPEED] = 6.0
p.actorValue[AVKey.SPEEDBUFF] = 1.0
p.actorValue[AVKey.ACCEL] = ActorHumanoid.WALK_ACCEL_BASE
p.actorValue[AVKey.ACCELBUFF] = 1.0
p.actorValue[AVKey.JUMPPOWER] = 19.0
p.actorValue[AVKey.BASEMASS] = 599.16
p.actorValue[AVKey.SCALEBUFF] = 1.0 // Constant 1.0 for player, meant to be used by random mobs
p.actorValue[AVKey.STRENGTH] = 5000
p.actorValue[AVKey.ENCUMBRANCE] = 10000
p.actorValue[AVKey.BASEHEIGHT] = 90
p.actorValue[AVKey.INTELLIGENT] = true
p.actorValue[AVKey.__PLAYER_QUICKSLOTSEL] = 0
p.actorValue[AVKey.__ACTION_TIMER] = 0.0
p.actorValue[AVKey.ACTION_INTERVAL] = ActorHumanoid.BASE_ACTION_INTERVAL
p.actorValue[AVKey.NAME] = "Test Subject 1"
/*p.makeNewSprite(TextureRegionPack(ModMgr.getGdxFile("basegame", "sprites/npc_template_anim_prototype.tga"), 48, 52))
p.sprite!!.delays = floatArrayOf(2f, 1f/12f) // second value does nothing -- overridden by ActorHumanoid.updateSprite(float)
p.sprite!!.setRowsAndFrames(2, 4)*/
p.sprite = SpriteAnimation(p)
//p.spriteGlow = SpriteAnimation(p)
p.reassembleSprite(p.sprite!!, p.spriteGlow)
p.setHitboxDimension(28, p.actorValue.getAsInt(AVKey.BASEHEIGHT) ?: ActorHumanoid.BASE_HEIGHT, 24, 0)
p.setPosition(3.0 * CreateTileAtlas.TILE_SIZE, 3.0 * CreateTileAtlas.TILE_SIZE)
PlayerBuilderSigrid.fillTestInventory(p.inventory)
//p.actorValue[AVKey.LUMR] = 0.84
//p.actorValue[AVKey.LUMG] = 0.93
//p.actorValue[AVKey.LUMB] = 1.37
//p.actorValue[AVKey.LUMA] = 1.93
p.actorValue[AVKey.AIRJUMPPOINT] = 0
p.actorValue[AVKey.SCALE] = 1.0
return p
}
}