Though It Had Left

Though it had left
It’s now come right
Back where it had been

Motion-bereft
Don’t try to fight
It upon the green

Ocean of land
Won’t sail by
Hit by open door

Know that it’s planned
Fits into this
Black Hair Universe

Stop

2/47


Writing Rewrite

I finally finished rewriting a part of blockling that I’ve been (slowly) working on for a few weeks now. It’s one of those little details that will probably go completely unnoticed by most people. But it was really bugging me.

It’s kind of hard to explain, but word-wrapping, centering, and displaying text used to all be done in one horribly messy function. It was a case of something that started small, but then I started adding to it until it grew into a monstrosity that would produce things like this:

Screenshot of blockling in which the player's speech-text is centered, but not above the player's head.

It was actually positioning the text in the best place it could, because if it would have moved it over to the left, then subsequently spoken text would not be centered over the same spot, since it would have a different width; and trying to read text which is jumping around is not fun.

It was basically a compromise. An ugly compromise.

So after some thought, I discovered that if positioning and drawing were done in two separate places, and if each line was independently positioned in the best possible spot, I could not only get aesthetically better results, but do so with code that was waayy more clean and object-orientedy.

Screenshot of blockling in which the player's speech-text is beautifully positioned over the player's head

You really have to try moving the camera around in order to see what’s going on with the text-flow. In other words, you should download it right now =)


Navigation