Closed thombruce closed 10 months ago
Also, the way I'm writing credits at the moment directly into the .rs
file is overly cumbersome. I should try to implement a way to load credits from a .json
, .toml
, .ron
or .yml
file. Backers will probably be loaded from a .csv
as this is what sites like Ko-fi and Patreon export.
Ideally credits would...
Step one is easy. We just alter their spawn coordinates.
Step two is easy. We just modify their Y coordinate on every Update.
Step three...
Can we get the height of the credits text entity? This would give us a Y position to reach above the screen. The credits scroll system could then, upon reaching this, return the player to the StartMenu.
Should be easy enough.
Wow. That third point is not easy at all. You can't use comparators to compare two Val
components, meaning I can't do something like style.top <= -style.height
. That's just not allowed... and I can't see a way to get the pixel values from these as floats. π
We do have scrolling credits though. I'm going to leave this open, but I am going to push the new scrolling credits which include the previously omitted audio credits.
The problem:
For the time being, the credits do just roll off screen and... nothing happens. You aren't returned to the menu, they don't roll around again. Nothing happens.
I need some way to acknowledge that the credits have rolled their full length and respond to this, but I just don't see a way to do that yet.
Since the credits do now scroll though, I am happy to remove the v0.0.16 milestone and leave this as something to figure out before v0.1
Here's a thought...
Instead of updating the value of the styles directly, could we update a component with an f32 value?
Say it has an initial value of 1000.0 (or whatever the screen's Y extent is). Every tick, we subtract the same value from it we had been subtracting from the pixel value with .try_sub()
. And every tick we reassign the style.top
with a new Val::Px()
set to the value of the f32 component.
We also keep track of the .size()
of both the window extents and the credits and when Component f32 goes below the negated Y of the credits size... then we swap state back to the StartMenu.
Yep: 3b098bd57ed92afcc4da743e04458102ca77f060
I just had to get the .size()
of the Node
itself rather than the style of its contents. Of course.
I mean, not of course - that's hardly intuitive - but it works!
There's plenty more I want to add to the credits. In the mid-to-long term:
In the more immediate term, I've added a new audio asset and am unable to fit the credit on screen. I want to append this to the credits, but will need to implement scrolling in order to start showing more info: