-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add layers to Sprite2D for easier animation #4370
Comments
If all your sprites have the same size, you can just set the texture from code or even as part of the animation. |
In my case the amount of work involved before making this LayeredSprite of mine was 19 * ( 4 * 16 ) or 1,216 keys entered manually. With my layered sprite it became 64 keys. |
I remember seeing a very similar proposal about this, but I can't find it right now. |
The proposal makes more sense now that you better explained your use-case. btw the script can be simpler if you inherit Sprite instead of Node2D (just don't assign it any texture). Also instead of keeping track of the layers in an array, you could just iterate all children. |
Just realized I did the math slightly wrong. It's not |
@KoBeWi |
I do like the idea of inheriting from Sprite instead of Node2D for the properties though. I guess I felt weird making a sprite derivative that created a bunch of child sprites, lol. |
Describe the project you are working on
So, I was working on a game with 2D Sprites, something like this.
This "actor" scene has 19 sprites, all of which use the exact same key frames for every sprite. That means I'm setting 19 sprites to the exact same thing for every frame of every animation I make every time. So my suggestion is a LayeredSprite node. Instead of "Texture" and "Normal" have a "Layers" integer that decides the size of a "Textures" array and a "Normals" array and you can dump all the sprite sheets you want into this array in the order they are drawn (top drawn first to match Scene order).
The key feature of this LayeredSprite is that it everything is identical on all layers (except texture and normals, obviously) If you change VFrames, every layer will use the same. If you change the Frame from 0 to 1, it changes the frame on all layers. It would allow working with sprite sheets like this
which has a matching sheet for hair, eyes, clothes, etc so much more intuitive. I'm doing 19 times the work than I would if this LayeredSprite node existed.
Describe the problem or limitation you are having in your project
The problem is that I have to animate 19 sprites with the exact same information every frame for every animation and it adds up.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
By adding this simple LayeredSprite, anyone that uses layered sprite sheets like what I have and what you find all over the internet would be able to animate all of it with exponentially less work. The most tedious part of animating in my game is having to go "Ok, next frame. Shadow, frame 0. Ear, 0, headaccessory, 0..." through all 19 of them just to then turn around and do it again for frame 1.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
It should be simple enough to implement I would think. I actually made my own version of it as a Scene object. Perhaps this code could be useful to derive from in some way. I'm sure my design is far from optimal but hopefully it serves to demonstrate my idea.
If this enhancement will not be used often, can it be worked around with a few lines of script?
Well, that's up to you to decide.
Is there a reason why this should be core and not an add-on in the asset library?
I feel like it's a simple enough quality of life thing that having it there would improve things for everyone that could use it and it wouldn't affect anyone that didn't. I would think it would be
The text was updated successfully, but these errors were encountered: