Text disappears when Pausing

lilika

Member
Hey guys, when I pause the game while the text is still progressing, everything works fine. But when I pause it after the text has finished typing out, it disappears. This happens even when I start the room with textprogress at a really high value and it happens when the text would have finished progressing. Please help? Thanks so much, I looked through my whole project file twice and tested every tiny thing that I thought might have possibly caused it but no luck! Also I don't know if there's some information I can attach to help with this.
 

lilika

Member
Hi, here's all the code that I think might be relevant. Thanks so much @TsukaYuriko and anyone else who has an idea!
i formatted this for 12 years pls help me LOL thanks

1. oText
a. CREATE

//coordinates
x1 = 200; // w x0 1/2
y1 = 420; // h - 70 //this one works others might not
x2 = 880 // w x 1/2
//y2 = 40; //h

//x1Target = 1;
//x2Target = 1;

textProgress = 0;
message = ""; //leave this blank

spd = 0.2; //speed of text scrolling
letters = 0; //current number of letters we're drawing (at start..)
text = "You be reading ****!\n**** em up FAM";
length = string_length(text); //determines how long the string is based on what u wrote in the text quote
text_current = ""; //current word of the string
w = 0;
h = 0;
border = 10; //width height and border


b. STEP
t
extProgress += global.textSpeed;


if (keyboard_check_pressed(vk_space))
{
var _messageLength = string_length(message);
if (textProgress >= _messageLength)
{
instance_destroy(); //when they press space, clear the message away.
if (instance_exists(oTextQueued)) //reduce ticket number of every text queued object
{
with (oTextQueued) ticket--; //look at the queue ("ticket") number and reduce it by 1.
}
}
else
{
if (textProgress > 2)
{
textProgress = _messageLength;
}
}
}


c. DRAW GUI

/// @desc Draw textbox
//NineSliceBoxStretched(sTextBoxBg1,x1,y1,x2,y2,background);
draw_set_font(fDialogue1);
//draw_set_halign(fa_center);
//draw_set_valign(fa_top);
draw_set_color(c_black);

var _print = string_copy(message,1,textProgress);
draw_text((x1+x2) /2, y1+8, _print);
draw_set_color(c_white);
draw_text((x1+x2) /2, y1+7, _print);


d. DRAW

//var halfw = w * 0.5; //get half the width because we'll be drawing it outwards from the center

//Draw the box
draw_set_color(c_black); //color
draw_set_alpha(0.5); //opacity
//draw_roundrect_ext(x-halfw-border,y-h-(border*2),x+halfw+border,y,15,15,false); //false means no outline
draw_sprite(sMarker,0,x,y); //add the bottom marker
draw_set_alpha(1);

//Draw text
DrawSetText(c_white,fSign,fa_center,fa_top);
draw_text(x,y-h-border,text_current);


2. oGame
a. CREATE

/// @desc Initialize & Globals
randomize();

global.gamePaused = 0;
global.textSpeed = .75;


b. END STEP

/// @desc Pause game
if (keyboard_check_pressed(vk_escape) and room != rMenu) //if you press escape and you're not on the main menu
{
if global.gamePaused == 0
{
global.gamePaused = 1;
with(all) //selects all active game objects
{
gamePausedImageSpeed = image_speed;
image_speed = 0; //pause animation
spd = 0;
}
}
else
{
with (all)
{
global.gamePaused = 0;
image_speed = gamePausedImageSpeed; //this is counterintuitive but it resumes animation
spd = 0.2; //resume animation
}
}
}


3. oPauseBG
a. CREATE

image_alpha = 0;

b. END STEP

if global.gamePaused
{
image_alpha = 0.5;
}
else
{
image_alpha = 0;
}


4. oBtnPauseResume
a. END STEP

if global.gamePaused
{
image_alpha = 1;
}
else
{
image_alpha = 0;
}


b. LEFT RELEASED

//if the image opacity is at least slightly visible:
if image_alpha > 0
{
//Press and release Escape for the player, unpausing the game:
keyboard_key_press(vk_escape);
keyboard_key_release(vk_escape);
}
 

TsukaYuriko

☄️
Forum Staff
Moderator
Next time, use [CODE=gml]code[/CODE] tags so you don't have to spend 12 years on formatting... :)

What is DrawSetText, what does it do and what is its code?
 
Top