Skip to content
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

Per character text effects #3250

Open
ACrazyTown opened this issue Sep 12, 2024 · 6 comments
Open

Per character text effects #3250

ACrazyTown opened this issue Sep 12, 2024 · 6 comments

Comments

@ACrazyTown
Copy link
Contributor

ACrazyTown commented Sep 12, 2024

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

@Geokureli
Copy link
Member

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

@DetectiveBaldi
Copy link
Contributor

DetectiveBaldi commented Sep 13, 2024

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?

@Geokureli
Copy link
Member

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.

@Vortex2Oblivion
Copy link
Contributor

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)

@Geokureli
Copy link
Member

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
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants