Linked sprite support, custom MovingSprite light sprites#2753
Linked sprite support, custom MovingSprite light sprites#2753provigz wants to merge 32 commits intoSuperTux:masterfrom
MovingSprite light sprites#2753Conversation
Objects which utilize more than 1 sprite now get the files of their additional sprites from the main one's "linked-sprites" list. This allows for expanded sprite customization for objects.
Custom lightsprites can now be added to all objects, which inherit `MovingSprite`. Setting a custom color for the lightsprite is also possible, as long as the object is not designed to use foreign color values (for example, from an option).
[ci skip]
|
Do the light sprites work per action or is it one for all? |
One for all, currently. I think per-action could be done, though. |
That would be nice to have for sure |
I'm thinking it could be done by having the same block available in |
Linked sprites can now be added to sprite actions too. If a sprite with the same key is found in the general linked sprites block and the action-specific one, the sprite specified by the action will be prioritized, thus overriding the default linked sprite file.
|
What was this trying to fix? |
Hardcoded sprites. |
|
@Vankata453 My brain explodes by trying to form this words so I'll do it like this. Can I:
The way I originally was hoping we could achieve that was through a special tag within an action. The way the tag would work is that it will check for action names within the linked sprite file (in this case |
|
@Rusty-Box Action-specific I modified your example, so by default it globally (for all actions) links the At the end, the modified example looks like this: |
Wait but Dive Mine's glow never changes. Rather is disappears when it should begins playing the ticking action, as of now. Is there just no way to define that right now? I'm so confused |
As I mentioned in the beginning, it still has to be done, I just offered a way it could work. |
|
Okay. Good to know. I thought I was going crazy here 😅 |
|
May be better in terms of readability, but would be more of a pain to implement. :D (Oh, and this approach is also way more flexible, since you can also change the whole sprite, not just the action.) |
|
Is it just me or is it not working? I updated Dive Mine's sprite file to look like you showed in this example here but it doesn't seem to work. The light keeps disapearing when you approach Dive Mine instead of changing the action of the linked sprite. Am I doing something wrong here? |
|
Also the candle light doesn't seem to be rendered as a lightmap since you get a black box when you place it |
MatusGuy
left a comment
There was a problem hiding this comment.
Still not sure about the efficiency on this. I think we should build some sort of system to store light textures as surfaces instead of sprite files. Most of these "light sprite files" have only one light with one action anyway. But we can leave this suggestion for another PR, because this one is already heavily demanded, even by me.
Almost there!
There was a problem hiding this comment.
Wow really? What did you change here?
| { | ||
| SoundManager::current()->preload("sounds/switch.ogg"); | ||
| m_lightsprite = Surface::from_file("/images/objects/lightmap_light/bonusblock_light.png"); | ||
| m_lightsprite = m_sprite->create_linked_sprite("on-light"); |
There was a problem hiding this comment.
This m_lightsprite name still hasn't been changed. In my opinion, if you are required to load & allocate another sprite, just to control when to draw it, then this system is heavily flawed. At least I think that's what's going on... The PowerUp class seems to handle this fine.
There was a problem hiding this comment.
What this is doing is only creating the "on-light" sprite when it's needed, which is only if the bonus block contains light.
|
What are the remaining tasks? |
Hypernoot
left a comment
There was a problem hiding this comment.
I tested all flammable badguys, light sources, glowing powerups and weak block.
all work
|
Can you mark all |
|
Unfortunately, this cannot work, as a const function cannot return non-const references. Even if you change the definition of |
There are numerous crashes and bugs that have been occuring due to this commit. I think it just needs a little more time to bake in the oven. I'm sure we could get the feature in the door by the time 0.7 releases, but it's simply too risky to push out right before release since it involve too many critical backend changes. For now, we revert :( It's planned to put this back in after 0.7 releases though. This reverts commit 805d08b.
|
Since #3418 was reverted, I'm reopening this PR. It only has to have master merged in to fix conflicts. |
|
Bugs known so far:
|
|
@provigz You didn't reopen. I'm going to. |
There are numerous crashes and bugs that have been occuring due to this commit. I think it just needs a little more time to bake in the oven. I'm sure we could get the feature in the door by the time 0.7 releases, but it's simply too risky to push out right before release since it involve too many critical backend changes. For now, we revert :( It's planned to put this back in after 0.7 releases though. This reverts commit 805d08b.
There are numerous crashes and bugs that have been occuring due to this commit. I think it just needs a little more time to bake in the oven. I'm sure we could get the feature in the door by the time 0.7 releases, but it's simply too risky to push out right before release since it involve too many critical backend changes. For now, we revert :( It's planned to put this back in after 0.7 releases though. This reverts commit 805d08b.
There are numerous crashes and bugs that have been occuring due to this commit. I think it just needs a little more time to bake in the oven. I'm sure we could get the feature in the door by the time 0.7 releases, but it's simply too risky to push out right before release since it involve too many critical backend changes. For now, we revert :( It's planned to put this back in after 0.7 releases though. This reverts commit 805d08b.
Custom light sprites can now be added to all objects, which inherit
MovingSprite. Setting a custom color for the light sprite is also possible, as long as the object is not designed to use foreign color values (for example, from an option).To add a light sprite with an RGB color of
0.5, 0.2, 0.25, in a.spritefile:Keep in mind that specifying color values is optional. The entry can also end after specifying the file.
Additionally:
linked-spriteslist (the same block wherelightsprites can also be added, as shown above). This allows for expanded sprite customization for objects.To add linked sprites, in a
.spritefile:Linked sprites can be added under sprite actions, too. If a sprite with the same key is found in the general linked sprites block and the action-specific one, the sprite specified by the action will be prioritized, thus overriding the default linked sprite file.
Sprites, which the specific object does not support, will be ignored.
flip-offsetproperty, which determines how much the sprite should be vertically offset when flipped vertically.