GameMaker Could you guys please help me? Text and talking sprite animation

J

Jesus17

Guest
Hey guys I'm new at this. I'm from Colombia bu I had to come here bc I can't get enough information for my "problem"
As you can see at the title I wanna know how to stop my sprite animation "How to stop its mouth when the text finishes (bc it is a typewritter effect)"
because its mouth keeps talking forever.
My strings are composed by array, I am going to show you all
_Before coming here I swer I have tried by myself but I couldn't_ If you could give me some idea, IT Would BE GREAT!

GML:
Create

text [0] = "Me gustaria saber algo..."
text [1] = "Que quieres saber?"

message_current = 0;
message_end = 1;
message_draw = "";
increase = 0.5;
characters = 0;
hold = 0;

message_length = string_length(text[message_current]);
GML:
Step



if (characters < message_length) {

    hold = keyboard_check(vk_enter);

    characters += increase * (1 + hold);

    message_draw = string_copy(text[message_current], 0, characters);

}

else {

    if (keyboard_check_pressed(vk_enter)) {

        if (message_current < message_end) {

            message_current += 1;

            message_length = string_length(text[message_current]);

            characters = 0;

            message_draw = "";

        }

        else {

            instance_destroy();

        }}}

if message_current = 0

{

    sprite_index = Sue}
GML:
Draw

draw_self()
draw_text(x-280,y+250, message_draw)
draw_set_color(c_blue)
draw_set_halign(fa_left)
 
Last edited by a moderator:

TsukaYuriko

☄️
Forum Staff
Moderator
That is why you have to execute this line after the typewriter is done - as in, once the whole message is displayed. ;)
 
J

Jesus17

Guest
That is why you have to execute this line after the typewriter is done - as in, once the whole message is displayed. ;)
Hey! Thanks for replying, I got it now, It makes sense. Although I dont know the exactly part to. Would you be able to show me how you would use that line in the step code?
Thanks!
 
Top