flixel icon indicating copy to clipboard operation
flixel copied to clipboard

Per character text effects

Open ACrazyTown opened this issue 1 year ago • 7 comments

I haven't looked at the drawing code for FlxText/FlxBitmapText so I don't know how feasible this is, but I think per character text effects would be a nice feature.

For example, this text shake in UNDERTALE: shake

Each character has a unique shake. As far as I know the only way to implement this currently would be to have each character be a seperate text object which could get tedious to manage

ACrazyTown avatar Sep 12 '24 20:09 ACrazyTown

FYI this simply isn't possible for FlxText, since FlxText is a openfl TextField drawn to a bitmap, but FLxBitmapText would work

Geokureli avatar Sep 13 '24 13:09 Geokureli

FYI this simply isn't possible for FlxText, since FlxText is a openfl TextField drawn to a bitmap, but FLxBitmapText would work

how would you do something like this on an FlxBitmapText?

DetectiveBaldi avatar Sep 13 '24 17:09 DetectiveBaldi

Ngl, it's not a trivial task, to have a generalized per-char effect system, but you may be able to extend it and implement some ad-hoc implementation of this specific effect, but even then it might not work on flash, and it may be tricky to work with outlines.

Chars are actually rendered here, but the positions they are drawn to are decided when text changes, over here.

Geokureli avatar Sep 13 '24 21:09 Geokureli

FYI this simply isn't possible for FlxText, since FlxText is a openfl TextField drawn to a bitmap, but FLxBitmapText would work

It looks like someone already did it here (unless this is done differently)

Vortex2Oblivion avatar Sep 17 '24 00:09 Vortex2Oblivion

FYI this simply isn't possible for FlxText, since FlxText is a openfl TextField drawn to a bitmap, but FLxBitmapText would work

It looks like someone already did it here (unless this is done differently)

I completely forgot this existed, I should dive into this

Geokureli avatar Sep 17 '24 15:09 Geokureli

Looking into this, it seems to draw text as a series of single-character FlxText instances, so it doesn't need to work around the caveats of FlxBitmapText, nor does it have many of the features of either FlxText and FlxBitmapText like borders.

It's not a clean solution but it works in a pinch, though, I worry that it may have terrible memory usage. It's also a one-stop shop for "dialogue text" coupling per-char effects and typewriter effects into a single class, meaning you can't just show text with effects without having it type each character out

I'd use it in a game jam, if the kerning issue was fixed, but not in a larger game project

Geokureli avatar Sep 17 '24 17:09 Geokureli

@Vortex2Oblivion I also wanted a system like this and ended up building my own that looks to take a similar approach as that Textbox library. Mine isn't fully polished by any means, but in case the code is useful (either to use/borrow from/whatever), this is the lib: https://github.com/bitDecayGames/LucidText

We used it to make this game (as an example of what it can do): https://youtu.be/tWLD0ZEyiPE?t=76

MondayHopscotch avatar Feb 25 '25 23:02 MondayHopscotch