JohnSundell / ImagineEngine

A project to create a blazingly fast Swift game engine that is a joy to use πŸš€
Other
1.83k stars 105 forks source link

Dialogue Plugin #139

Closed Alex88WH closed 6 years ago

Alex88WH commented 6 years ago

Hey there! I'm trying to create a plugin that handles dialogues. I could use some help :D The final goal is a plugin that can be added on any kinda games. Something simple like a sign in a village or even a complex dialogue with characters.

I’ve two games (dialogue system or something like that) in mind:

Fire Emblem Heroes uspiuus

Undertale

screen shot 2018-01-11 at 18 24 13

I tried to play with those in mind on a Playground. What I got so far:

screen shot 2018-01-11 at 16 58 23

screen shot 2018-01-11 at 18 49 38(Raven of Fire Emblem. Testing)

Next:

This is it! I’m a beginner and I don’t know if I can create something like that using clean and elegant code or best practices at all (But I’m learning. Reading Imagine Engine is helping me a lot). I could use some direction or tips. Thanks and sorry for all English mistake :D

JohnSundell commented 6 years ago

@Alex88WH Wow that looks really cool! πŸ˜„ I think a plugin like that could be of great value to the community since creating these kinds of dialogs is very common in many different kinds of games.

For multiline, the good news is that it's quite easy to add support for it. CATextLayer (which Label uses for rendering) has a isWrapped property that if set to true auto-wraps the text within the layer's bounds. So all we really need to do is expose that as part of the Label API and it should just work. Did a quick hack and here's what it looks like with isWrapped = true:

screen shot 2018-01-11 at 23 06 04

As for a typing effect, one way to solve that would be to create an Action that changes the label's text property by adding one character at a time after a certain interval. That should generate that type of type-writer effect which is normally seen in RPGs etc.

Let me know what you think of the above πŸ˜„ Also if @insidegui, @mattiashagstrand or anyone else have any ideas then feel free to pitch in πŸ˜‰

Alex88WH commented 6 years ago

That's awesome!! Working here, thanks! πŸŽ‰ I'll post more progress later on ✌︎ jan-12-2018 11-24-50 (shouldAutoResize as false!)

JohnSundell commented 6 years ago

Awesome! Added issue #142 to add support for line wrapping to Label πŸ‘

mattiashagstrand commented 6 years ago

Very nice!

To allow for even more text effects we could make Label Rotatable and Scalable as well. Shouldn't be to hard or what do you think @JohnSundell?

JohnSundell commented 6 years ago

@mattiashagstrand Sounds like a plan! πŸ‘

JohnSundell commented 6 years ago

@mattiashagstrand Created issues #152 & #153 for scaling & rotation for labels, think they can be great starter tasks πŸ˜„

JohnSundell commented 6 years ago

@Alex88WH Do you think you need more engine changes to implement your plugin? It looks like you're good to go, right?

Alex88WH commented 6 years ago

Yep! I'm working on it! Gonna close this issue. Thank you all 🀩 (I'll post updates and the plugin itself when I finish it (or at least make it viable to use))