1

hi all.
i'd like to try to make cutscenes in style manamon, how can i do? thanks

...

Thumbs up

2

The way I do it is to use a string array containing the lines. If the scene calls for something more complicated, like sounds or music changes, I include these as commands at the end of the line they should follow, separated from the spoken text by |, and each command is separated by \n.
Then, I have 2 functions: one for reading the current line (remember that it's good to let players repeat it before continuing), and one for advancing to the next line, which is where the extra commands are parsed. Explaining how the command-parsing works is a bit much for this post as it is.
Then, when a scene is in progress, call the advance function when the player presses enter, and read when the player presses a direction. Or use whichever controls you want (remappable controls are nice), so long as there's a button or more for each action.
Skipping is a simple matter of clearing the array, unless you're using extra commands that you need to have happen even if the player skips the scene. If not, resize(0) is good enough. If so, you'd need to do more interesting parsing on skipping.

Some of my games
Keep up to date by following @Jeqofire on twitter!
Ear Ninja?

Thumbs up

3

so basically i need a string with the scene and putting in to the array the scene i'd like so when ever i need it i'll call it?

...

Thumbs up

4

The cool thing about making games is that there are so many ways to make something, like cutscenes, maps, battels etc. The developer just has to choose it's best way. I was making a cutscene by writing a function that receives a String parameter for the text, and then waits for user to press Enter to continue. I also wrote a similar function that will play a sound either before or after the spoken text or a certain amount of time. But implementing arrays is also a good idea, to avoid repetitive function calls.
Anyway, here's my cutscene code that I wrote for my never-finished game.
bool cutscene_is_playing; // must be set to True when starting a cutscene and False when ending it
sound sound_click, sound_finished, sound_effect; // sound handles for cutscene events

// A function to play an Intro scene,
// that will fade out when user presses Enter.
// I'm using my custom music class here.
void intro_play(string file)
{
music.stream(file);
music.play();
while(music.playing==true)
{
if(key_pressed(KEY_RETURN))
{
music_fade(@music, music.volume, -50, 1000, false);
music.stop();
}
}
}

/*
Plays the current line of a cutscene with a sound file.
The wait parameter, if set to true, will wait the sound to finish, rather than playing it over spoken cutscene text.
P.s., the say function is my custom function for speaking text via sapi or a screen reader.
*/
void cutscene_line(string text, string file="", bool wait_sound=false)
{
if(cutscene_is_playing==false)
{
cutscene_play_finished();
return;
}
sound_effect.load("sounds/cutscene/"+file);
if(wait_sound==true)
{
sound_effect.play_wait();
}
else
{
sound_effect.play();
}
sound_click.load("sounds/cutscene/click.wav");
sound_click.play();
say(text);
while(cutscene_is_playing==true)
{
if(key_pressed(KEY_RETURN))
{
break;
}
if(key_pressed(KEY_ESCAPE))
{
cutscene_is_playing=false;
break;
}
if((key_down(KEY_LMENU))&&(key_pressed(KEY_F4)))
{
exit();
}
}
}

void cutscene_play_finished()
{
sound_finished.load("sounds/cutscene/end.wav");
sound_finished.play();
}

Thumbs up

5

I wonder if you could if you wanted too, is instead of having text being spoken, a person can vocally say a line.

Sincerely:
John Follis

Thumbs up

6

Of course! You just make a function that receives a sound handle as parameter, plays that sound, and then waits for user to press Enter or whatever to scroll to the next line.

Thumbs up

7 (edited by pauliyobo 2017-10-29 09:15:30)

thanks a lot for this example, hrvoje! smile

...

Thumbs up