我一直在努力简单地显示当前时间,但找不到解决方案…很抱歉放错地方了。
我只想在用户的电脑或手机上显示时间。
我能做的就是让时间显示在一个框消息中,而不是让它每秒钟都显示和更新。
这是我当前的代码
//store the current time
t=date_current_datetime();
//get the hour portion of that time
h=date_get_hour(t);
//get the minute portion of the time.
m=date_get_minute(t);
//get the second potion of the time
s=date_get_second(t);
//show the time
txt="The current time is:"+string(h)+":"+string(m)+":"+string(s);
show_message(txt);
希望这个游戏制作代码是有意义的,感谢任何帮助。
Ok,添加到Create
事件:
txt = "";
alarm[0] = 1;
移动代码到Alarm 0
event:
//store the current time
t = date_current_datetime();
//get the hour portion of that time
h = date_get_hour(t);
//get the minute portion of the time.
m = date_get_minute(t);
//get the second potion of the time
s = date_get_second(t);
//show the time
txt = "The current time is: " + string(h) + ":" + string(m) + ":" + string(s);
alarm[0] = room_speed;
And last - Draw
event:
draw_text(10, 10, txt);
当然,您也可以使用Draw GUI
事件或视图坐标,如
draw_text(view_xview[0] + 10, view_yview[0] + 10, txt);