E
EridanLOKO
Guest
so, I made a simple textbox to one NPC, but in the first interaction, the text goes out of the box, but if you interact again, it's normal
help pls ;-;
my code:
create:
step:
draw:
help pls ;-;
my code:
create:
Code:
text = "nothin";
page = 0;
xBuffer = 5;
yBuffer = 5;
boxWidth = sprite_get_width(textbox);
stringHeight = string_height(text);
creator = noone;
charCount = 0;
name = noone;
Code:
if(keyboard_check_pressed(ord("E")))
{
if(page+1 < array_length_1d(text))
{
page += 1;
charCount = 0;
}
else
{
instance_destroy();
creator.alarm[1] = 1;
}
}
Code:
draw_sprite(textbox,0,x,y);
//Draw text
draw_set_font(fontezinha);
if(charCount < string_length(text[page]))
{
charCount += 1;
}
textPart = string_copy(text[page],1,charCount);
//nome----------------------
draw_set_color(c_white);
draw_set_halign(fa_center);
draw_text(x+boxWidth/2,y+yBuffer,name);
draw_set_halign(fa_left);
//textin--------------------
draw_set_color(c_white);
draw_text_ext(x+xBuffer,y+stringHeight+yBuffer,textPart,stringHeight,boxWidth - (2*xBuffer));
Last edited by a moderator: