From 0fa395acd555c9ddc50cb4d06fcfd58301da0c38 Mon Sep 17 00:00:00 2001 From: minjaesong Date: Wed, 7 Jul 2021 16:52:07 +0900 Subject: [PATCH] the new sprite fully assembled --- assets/mods/basegame/sprites/taimu.properties | 37 +++++++++++ .../basegame/sprites/taimu_glow.properties | 37 +++++++++++ .../test_werebeast/taimu_arm_rest_left.tga | 3 + .../test_werebeast/taimu_arm_rest_right.tga | 3 + .../sprites/test_werebeast/taimu_head.tga | 3 + .../test_werebeast/taimu_leg_rest_left.tga | 3 + .../test_werebeast/taimu_leg_rest_right.tga | 3 + .../sprites/test_werebeast/taimu_tail_0.tga | 3 + .../sprites/test_werebeast/taimu_torso_0.tga | 3 + .../sprites/test_werebeast/taimu_torso_1.tga | 3 + .../sprites/test_werebeast/taimuglow_head.tga | 3 + .../spriteassembler/SpriteAssemblerApp.kt | 6 +- .../terrarum/modulebasegame/TerrarumIngame.kt | 3 +- .../gameactors/PlayerBuilderWerebeastTest.kt | 65 +++++++++++++++++++ .../sprites/npc_template_humanoid_savage.kra | 4 +- 15 files changed, 173 insertions(+), 6 deletions(-) create mode 100644 assets/mods/basegame/sprites/taimu.properties create mode 100644 assets/mods/basegame/sprites/taimu_glow.properties create mode 100644 assets/mods/basegame/sprites/test_werebeast/taimu_arm_rest_left.tga create mode 100644 assets/mods/basegame/sprites/test_werebeast/taimu_arm_rest_right.tga create mode 100644 assets/mods/basegame/sprites/test_werebeast/taimu_head.tga create mode 100644 assets/mods/basegame/sprites/test_werebeast/taimu_leg_rest_left.tga create mode 100644 assets/mods/basegame/sprites/test_werebeast/taimu_leg_rest_right.tga create mode 100644 assets/mods/basegame/sprites/test_werebeast/taimu_tail_0.tga create mode 100644 assets/mods/basegame/sprites/test_werebeast/taimu_torso_0.tga create mode 100644 assets/mods/basegame/sprites/test_werebeast/taimu_torso_1.tga create mode 100644 assets/mods/basegame/sprites/test_werebeast/taimuglow_head.tga create mode 100644 src/net/torvald/terrarum/modulebasegame/gameactors/PlayerBuilderWerebeastTest.kt diff --git a/assets/mods/basegame/sprites/taimu.properties b/assets/mods/basegame/sprites/taimu.properties new file mode 100644 index 000000000..a1b48abc9 --- /dev/null +++ b/assets/mods/basegame/sprites/taimu.properties @@ -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 diff --git a/assets/mods/basegame/sprites/taimu_glow.properties b/assets/mods/basegame/sprites/taimu_glow.properties new file mode 100644 index 000000000..a1b48abc9 --- /dev/null +++ b/assets/mods/basegame/sprites/taimu_glow.properties @@ -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 diff --git a/assets/mods/basegame/sprites/test_werebeast/taimu_arm_rest_left.tga b/assets/mods/basegame/sprites/test_werebeast/taimu_arm_rest_left.tga new file mode 100644 index 000000000..16ce1ea4f --- /dev/null +++ b/assets/mods/basegame/sprites/test_werebeast/taimu_arm_rest_left.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5ed9741b180be8556fa8058b4df1a7dd9b4a89fe16d968a57f67c7dde25ff48b +size 2258 diff --git a/assets/mods/basegame/sprites/test_werebeast/taimu_arm_rest_right.tga b/assets/mods/basegame/sprites/test_werebeast/taimu_arm_rest_right.tga new file mode 100644 index 000000000..931bb49f0 --- /dev/null +++ b/assets/mods/basegame/sprites/test_werebeast/taimu_arm_rest_right.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:285c42477d6a8edc9bddfeb8db353043427686c1b03d214304cca6cb392606d8 +size 1942 diff --git a/assets/mods/basegame/sprites/test_werebeast/taimu_head.tga b/assets/mods/basegame/sprites/test_werebeast/taimu_head.tga new file mode 100644 index 000000000..515e59519 --- /dev/null +++ b/assets/mods/basegame/sprites/test_werebeast/taimu_head.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9158759ebac880f209af8c20672bb2032c57b053704830792c6e485be91ed8bd +size 1866 diff --git a/assets/mods/basegame/sprites/test_werebeast/taimu_leg_rest_left.tga b/assets/mods/basegame/sprites/test_werebeast/taimu_leg_rest_left.tga new file mode 100644 index 000000000..363d70689 --- /dev/null +++ b/assets/mods/basegame/sprites/test_werebeast/taimu_leg_rest_left.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb40e0151540415faac1df97092135005b0099be14ac84b0d066b6c130b80ae9 +size 2598 diff --git a/assets/mods/basegame/sprites/test_werebeast/taimu_leg_rest_right.tga b/assets/mods/basegame/sprites/test_werebeast/taimu_leg_rest_right.tga new file mode 100644 index 000000000..45f3a446a --- /dev/null +++ b/assets/mods/basegame/sprites/test_werebeast/taimu_leg_rest_right.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:39224e82ad4113135bada9dc61590f05e1a0e86735cf968801246b57b230b691 +size 2770 diff --git a/assets/mods/basegame/sprites/test_werebeast/taimu_tail_0.tga b/assets/mods/basegame/sprites/test_werebeast/taimu_tail_0.tga new file mode 100644 index 000000000..6758a6990 --- /dev/null +++ b/assets/mods/basegame/sprites/test_werebeast/taimu_tail_0.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1ae1ba7f4c2e37b9a125d53c76f4ccf0c2c6addce57b5cf8f6f56b368b40fd41 +size 4234 diff --git a/assets/mods/basegame/sprites/test_werebeast/taimu_torso_0.tga b/assets/mods/basegame/sprites/test_werebeast/taimu_torso_0.tga new file mode 100644 index 000000000..2d3db5bfe --- /dev/null +++ b/assets/mods/basegame/sprites/test_werebeast/taimu_torso_0.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7327a322aa9dc078f21b74b8e20e174c421320bce5fa67a8bb75248c7e03dc20 +size 3846 diff --git a/assets/mods/basegame/sprites/test_werebeast/taimu_torso_1.tga b/assets/mods/basegame/sprites/test_werebeast/taimu_torso_1.tga new file mode 100644 index 000000000..32054c72b --- /dev/null +++ b/assets/mods/basegame/sprites/test_werebeast/taimu_torso_1.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7e7ccb5b18abe665e8f692e2961e31e8f040fda98baeb9cd84e9a7ebecd52b7c +size 3846 diff --git a/assets/mods/basegame/sprites/test_werebeast/taimuglow_head.tga b/assets/mods/basegame/sprites/test_werebeast/taimuglow_head.tga new file mode 100644 index 000000000..da6bfae2c --- /dev/null +++ b/assets/mods/basegame/sprites/test_werebeast/taimuglow_head.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5005cdd2c9d8511d9f856375c91d8a64b2393ad763e2a0608006d67030ebfb1d +size 1866 diff --git a/src/net/torvald/spriteassembler/SpriteAssemblerApp.kt b/src/net/torvald/spriteassembler/SpriteAssemblerApp.kt index e94e95ecc..f3aaff476 100644 --- a/src/net/torvald/spriteassembler/SpriteAssemblerApp.kt +++ b/src/net/torvald/spriteassembler/SpriteAssemblerApp.kt @@ -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) { val appConfig = LwjglApplicationConfiguration() - appConfig.resizable = true + appConfig.resizable = false appConfig.width = 512 - appConfig.height = 512 + appConfig.height = 1024 appConfig.foregroundFPS = 5 appConfig.backgroundFPS = 5 diff --git a/src/net/torvald/terrarum/modulebasegame/TerrarumIngame.kt b/src/net/torvald/terrarum/modulebasegame/TerrarumIngame.kt index bc595bb2f..910b99309 100644 --- a/src/net/torvald/terrarum/modulebasegame/TerrarumIngame.kt +++ b/src/net/torvald/terrarum/modulebasegame/TerrarumIngame.kt @@ -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()) diff --git a/src/net/torvald/terrarum/modulebasegame/gameactors/PlayerBuilderWerebeastTest.kt b/src/net/torvald/terrarum/modulebasegame/gameactors/PlayerBuilderWerebeastTest.kt new file mode 100644 index 000000000..d2bee6606 --- /dev/null +++ b/src/net/torvald/terrarum/modulebasegame/gameactors/PlayerBuilderWerebeastTest.kt @@ -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 + } +} \ No newline at end of file diff --git a/work_files/graphics/sprites/npc_template_humanoid_savage.kra b/work_files/graphics/sprites/npc_template_humanoid_savage.kra index afe516f56..b7eece8e1 100644 --- a/work_files/graphics/sprites/npc_template_humanoid_savage.kra +++ b/work_files/graphics/sprites/npc_template_humanoid_savage.kra @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2ad81da3f2e65ab283a5ab3e0a12f52751fe6516c389ea2134bbbe3fd4333ed1 -size 210099 +oid sha256:8a656a96c8e2473acc21a676aa6a14bdfb44a8f9d0a964b619338d4858091560 +size 309070