alextrevisan / LPCAnimatedSprite2D

With this addon you simply add a LPC spritesheet to a character and it automaticly generates the animations for the Godot4 sprites
MIT License
49 stars 7 forks source link

Support larger weapon animations #5

Closed hades200082 closed 1 year ago

hades200082 commented 1 year ago

Example sprite sheet: https://sanderfrenken.github.io/Universal-LPC-Spritesheet-Character-Generator/#?body=Body_color_light&head=Human_male_light&wound_arm=none&wound_brain=none&prosthesis_hand=none&wings=none&ears=none&nose=Straight_nose_light&shoulders=Leather_leather&shield=Shield_round_brown&weapon_magic_crystal=none&weapon=Longsword_longsword&shoes=Boots_charcoal&hair=Spiked2_raven&beard=none&horns=none&fins=none&bandana=none&headcover=none&hat=none&bauldron=Bauldron_walnut&wrists=Cuffs_leather&gloves=Gloves_leather&armour=Leather_bluegray&cape=Solid_leather&belt=Leather_Belt_leather&legs=Pants_bluegray

Many of the weapons in LPC have larger sprite frames for slash and thrust.

alextrevisan commented 1 year ago

I'll start working on the oversized animations!

Loufe commented 1 year ago

Seconded! If I might make a suggestion: it would be awesome to be able to set the a separate idle states for those holding the larger sprite frames.

alextrevisan commented 1 year ago

I'm trying to figure out how to do it without making it overly complicated, because the frames on the oversized doesn't match the original sprites

Loufe commented 1 year ago

@alextrevisan yeah it's not obvious, it's part of the reason why I migrated to your extension.

I just checked some sheets I had laying around, here are the dimensions: Normal: *832 1344 Large weapon sheet dimensions: 832 x 1856**

Looking through your code, here's my first thought of how to implement it.

  1. When defining "AnimationData" add a check if height is 1856, if so, do a LPCAnimationData.new for these animations. Choosing whether to offer separate values in ENUM for slash/thrust or use uniquely the larger ones is worth thinking about. @hades200082 what would you prefer?

  2. Change "AddAnimation" to use 32 pixel sized row and column values. This solves the problem will help cover the inconsistent spacing in the screenshot below. You'd need to adjust all the calls in the AnimationData definiton portion, naturally. Adding a parameter for "starting" column has the added benefit of being able to create more values in enum. Personally, I'd love a "collapsed" enum which would hold the last frame of "HURT_DOWN".

image

  1. Separate atlasTexture.region definition for large tiles.

What do you think? I'd be happy to collab on it if you'd like.

alextrevisan commented 1 year ago

I wrote this code several times, and at the end it was simpler than I was expecting. Try this branch and see if it works for you

image

alextrevisan commented 1 year ago

I see that you use the complete spritesheet. The way I did was using the separated sprites from the LPC repo like this: https://github.com/sanderfrenken/Universal-LPC-Spritesheet-Character-Generator/blob/master/spritesheets/weapon/sword/longsword/attack_slash/longsword.png

Maybe I will add another type, like "CompleteLPCSpriteSheet" that has all the animations like you are using

On the default spritesheet the animations for oversized starts on diferent X position from yours @Loufe

image

Loufe commented 1 year ago

@alextrevisan just remembered the offsets are broken because I cut-pasted them replacing the existing "IDLE" animations above, the correctly generated sprite has the correct spacing.

As for the components vs assembled... I think the components is more versatile, but we haven't needed it yet. For now, you don't need a "complete" class, as the existing system inherently supports them.

More comments in the PR.

alextrevisan commented 1 year ago

Done: https://github.com/alextrevisan/LPCAnimatedSprite2D/pull/11