这里是网易云伴侣翻译结果:
我在 Peyten Burnham 的 GameMaker 教程中制作对话系统。
当我试图启动游戏时,我遇到了一些奇怪的文本输出,并且我不确定存在什么问题。
我完全是一个新手,编程完全不知道所以也无法确定哪里出了问题。
如果有人能帮我解决这个问题,将会非常感谢。
OBJ_settings
create: 全局.font_main = font_(fnt_menu, 32, true, 1, 1, 32);
Cleaning up: font_delete(global.font_main)
OBJ_speakblock
Step:
if(position_meeting(mouse_x, mouse_y, id) && mouse_check_button_pressed(mb_left)
{
create_textbox("npc1")
}
create:
text_id = "";
OBJ_textbox
create:
深度 = -99991;
//textbox参数
textbox_width = 708;
textbox_height = 308;
border = 8;
line_sep = 40;
line_width = textbox_width - border*2;
txtb_spr = SPR_textbox;
txtb_img = 0;
txtb_img_spd = 0.
//文本
页数 = 0;
页数 _number=0;
text[0] = [""];
text_length [0] = string_length(text[0]);
draw_char = 0;
text_spd = 1.
配置 = false;
Draw:
接受 键盘= 键盘_检查_按下 (vk_空白 );
textbox_x = 视图 _get_查看 _x(查看 _camera [0] )
textbox_y = 视图 _get_查看 _y(查看 _camera [0] ) + 464.
//设置
if配置 == false
{
配置 = true;
draw_set_font(全局.font_main);
draw_set_valign(fa_上 ");
draw_set_halign(fa_左 ];
//循环遍历 页数
页数_数字 = 字组.array _length(text);
for(var p = 0; p < 页数_数字; p++)
{
//没有。 的字符/页数,存储在text_length数组中
text_length [p] = string_length(text [p]);
//textbox的x位置(无需文字)
textbox_x _offset [p] = 152;
//无需代码了
}
//不用代码了
}
//打字?
if draw_char < text_length [page]
{
draw_char += text_spd;
draw_char = clamp(draw_char, 0, text_length [page])
}
//翻阅页数?
ifaccept键
{
//打字完毕
if draw_char == text_length [page]
{
//下一页
如果页数 < 页数 _数字 - 1
{
页数 ++
draw_char = 0;
}
//清除文本框
else
{
当前实例_destroy()
}
//有一个
}
//没有完成打字
else
{
draw_char = text_length [page];
//不需要代码了
}
// ?
txtb _img += txtb _img _spd;
txtb _spr _w = sprite _get _width(txtb _spr)
txtb _spr _h = sprite _get _height(txtb _spr)
//textbox后面
draw_sprite_ext(txtb _spr,txtb _img,textbox _x + text _x _offset [page],textbox _y,textbox _width / txtb _spr _w,textbox _height / txtb _spr _h,0, c _白色,1)
//绘制文本函数
var_drawtext = string_copy(text [page],1,draw_char)
draw_text_ext(textbox _x + text _x _offset [page] + 边界,textbox _y + 边界,_drawtext,line_sep,line_width)
scr_gametext
/**// @param text _id
功能scr_gametext(_text _id){
// ?
开关(_text _id){
//case?
情況“npc1”:
scr_text_functions(“hi iam amy”)
scr_text_functions(“im gay”)
scr_text_functions(“i like teeth”)
break;
//NPC2
情況“npc2”:
scr_text_functions(“hey iam john”)
scr_text_functions(“im gay”)
scr_text_functions(“i love your muscular teeth”)
break;
//NPC3
情況“npc3”:
scr_text_functions(“hi iam jamie”)
scr_text_functions(“im gay”)
scr_text_functions(“i like emeh”)
break;
//NPC }
}
**scr_text_functions:
///@ param text
功能scr_text(_text){
// ?
text [page_number] = _text,
page_number ++,
}
///@ param text _id
函数creation_textbox(_text _id) {
//??
current_instance = instance_create(obj_textbox) ,
//??
scr_gametext(_text _id),
//完成?
}
请原谅如果我的帖子非常混乱,学校项目由于马上到期,所以没有时间排版。
[我文件夹中的图片](https://preview.redd.it/2t25fd01rdog1.png?width=580&format=png&auto=webp&s=f6f28f7e28c20edbcb415042f6d8c398872446d9)
评论 (0)