-
-
Notifications
You must be signed in to change notification settings - Fork 494
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
Linked sprite support, custom MovingSprite
light sprites
#2753
base: master
Are you sure you want to change the base?
Conversation
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 Why does Dart Traps light have numbers in its linked sprite and why (when I change it) it either crashes my game or doesn't show any glowing. Is it hardcoded? It should care what I put there, should it? Since this is were you set it up to how you please when it comes to naming. It works with Dive Mine seemingly and I tried a similar naming convention. |
…`SpriteParticle`s
So there's missing sprites for the sparkle effect on keys and gold bomb uses the wrong glow path. It uses the same as Mr.Bomb but the image path looks for one in the gold bomb folder (obviously there's nothing there). I'll test adding more linked sprites to some enemies myself and see if that works as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The strawbox also is missing its lightsprite when enflamed, as it produces a black missing texture image.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While reviewing this there was one main thing in my mind: Is the loading cached? When a sprite is loaded, and then the same sprite is loaded, does it parse again? I'm unsure about the efficiency on this.
Also, in my review comments I mention a lot of stuff that looks like it only happens once, but it doesn't. A good example is several classes having their own light sprite.
Fantastic work though. I saw some great effort put into this.
No, it's created through |
Crushers and bricks now use linked sprites, instead of cloning their own sprite and setting actions on its clone.
I will test once the conflicts are resolved : ) |
Cannot reproduce these issues. Check if you have something in your user folder that perhaps is conflicting? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good now!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works perfectly now!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow really? What did you change here?
@@ -139,7 +138,7 @@ BonusBlock::BonusBlock(const ReaderMapping& mapping) : | |||
if (m_contents == Content::LIGHT || m_contents == Content::LIGHT_ON) | |||
{ | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What this is doing is only creating the "on-light" sprite when it's needed, which is only if the bonus block contains light.
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.sprite
file:Keep in mind that specifying color values is optional. The entry can also end after specifying the file.
Additionally:
linked-sprites
list (the same block wherelight
sprites can also be added, as shown above). This allows for expanded sprite customization for objects.To add linked sprites, in a
.sprite
file: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-offset
property, which determines how much the sprite should be vertically offset when flipped vertically.