Euphonia-Games / Heat-Death

A game about the death of a world and it's inhabitants
GNU General Public License v3.0
0 stars 0 forks source link

Game dialogue display system #2

Open Ph-ill opened 2 years ago

Ph-ill commented 2 years ago

I would like to implement multiple text display functions to animate dialog or information displaying on the canvas without the need to manually animate it all, I'm not sure which is the best way to do this I think possibly editing the exported .html file from wick editor to include another animation or text-effect library might be the easiest way but I'm not certain so any ideas on this topic would be good to hear.

Specifically I would really like the wavy old school runescape style text. image

Ph-ill commented 2 years ago

I just realized this is probably fairly simple, convert string of text into an array of characters and then modify each characters y position value with the javascript Math.sin() function

Ph-ill commented 2 years ago

So I've been trying to program this out, the logic is this

Manually create char_box text object, place it inside char_box_clip object.

Then on the Load or update script

Specify a string to be shown as wavy text

create as many clones of char_box_clip as there are characters in the string.

set the text of each one of the char_box text boxes within char_box_clips to the corresponding character from the string

on the Update script of the frame adjust the x & y values of each clip accordingly to make the text appear wavy (I've yet to attempt this part).

The code I've come up with for this is

var wave_text ="Wavy Baby"
var char_clone = [];

char_clone = char_box_clip.clone();

for (i = 0; i < wave_text.length; i++) {
    char_clone[i] = char_box_clip.clone();
    char_clone[i].char_box.setText(wave_text[i]);
}

However this results in the runtime error TypeError: Cannot read property 'setText' of undefined

I think maybe it's something to do with the text object inside the cloned clip either not being cloned with the clip or not being able to be referenced for some reason.

Either way I'm stuck please help.

Ph-ill commented 2 years ago

Look like it's a known bug, I'll continue using one of the workarounds listed here

https://forum.wickeditor.com/t/settext-inside-cloned-clips/4256/11