Codice: Seleziona tutto
//write your messages in an array, starting at 0, like so
message[0] = "Hey!";
message[1] = "Hi!";
message[2] = "?";
message[3] = ". . .";
message_current = 0; //0 is the first number in our array, and the message we are currently at
message_end = 0; //6 is the last number in our array
message_draw = ""; //this is what we 'write' out. It's blank right now
increase = 0.5; //the speed at which new characters are added
characters = 0; //how many characters have already been drawn
hold = 0; //if we hold 'Z', the text will render faster
message_length = string_length(message[message_current]); //get the number of characters in the first message
Codice: Seleziona tutto
//Draw the sentence
//Draw Event
x = view_xview + 15;
y = view_yview + 145;
draw_text_ext(x, y, message_draw, 30, 350); //draw the text at the coordinates
Codice: Seleziona tutto
if (characters < message_length) { //if current character count is less than the amount in current message*
hold = (mouse_check_button_pressed(mb_left));
characters += increase * (1 + hold);//increase speed based on hold
message_draw = string_copy(message[message_current], 0, characters); //copy string to current character
}
else { //if current character is more than the amount in the current message
if (mouse_check_button_pressed(mb_left)) {
if (message_current < message_end) { //if there are more messages left to show (0 -> 6, in our case)
message_current += 1; //increase the message by 1
message_length = string_length(message[message_current]); //get the new character length for message
characters = 0; //set the characters back to 0
message_draw = ""; //clear the drawn text
}
}
Codice: Seleziona tutto
if (message_current = 1){
if (mouse_check_button_pressed(mb_left)){
message_current = 1;
with(obj_boat)
{
sprite_index = boat;
}
with(ausiliar_names)
{
sprite_index = names;
image_index = 0;
}
}
}
if (message_current = 1){
if (mouse_check_button_pressed(mb_left)){
message_current = 2;
with(obj_boat)
{
sprite_index = boat;
}
}
}
if (message_current = 2){
if (mouse_check_button_pressed(mb_left)){
message_current = 3;
with(obj_boat)
{
sprite_index = boat;
}
}
}
if (characters = message_length){
with(obj_boat)
{
sprite_index =boat;
}
if (mouse_check_button_pressed(mb_left)){
instance_destroy();
with(obj_textbox)
{
instance_destroy();
}
with(ausiliar_names)
{
sprite_index = spr_transparent;
}
instance_create(0,0, object_cut2);
}
}
Codice: Seleziona tutto
if(message_current = 0){
with(ausiliar_names)
{
sprite_index = names;
image_index = 1;
}
with(obj_boat)
{
sprite_index = boat_speak_ja;
}
}
if(message_current = 1){
with(ausiliar_names)
{
image_index = 0;
}
with(obj_boat)
{
sprite_index = boat_speak_fr;
}
}
if(message_current = 2){
with(ausiliar_names)
{
image_index = 0;
}
with(obj_boat)
{
sprite_index = boat_speak_fr;
}
}
if(message_current = 3){
with(ausiliar_names)
{
image_index = 1;
}
with(obj_boat)
{
sprite_index =boat_speak_ja;
}
}