datetime - 显示当前时间 游戏制作者

标签 datetime game-maker

我一直在努力简单地显示当前时间,但在任何地方都找不到解决方案...对于错误的帖子感到抱歉。

我想要的只是显示用户电脑或手机上的时间。

我能做的是让时间显示在框中消息中,但不是让它每秒显示和更新。

这是我当前的代码

//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); 

希望这个游戏制作者代码有意义,感谢您的帮助。

最佳答案

好的,添加到Create事件:

txt = "";
alarm[0] = 1;

将代码移至Alarm 0 事件:

//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;

最后 - Draw 事件:

draw_text(10, 10, txt);

当然,您也可以使用Draw GUI事件或查看坐标,例如

draw_text(view_xview[0] + 10, view_yview[0] + 10, txt);

关于datetime - 显示当前时间 游戏制作者,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31370455/

相关文章:

Excel PowerQuery - 以正确的日期时间转换导入 SQL Server 日志的最佳方式?

utc - 有没有更简单的方法在 gamemaker 中获取 Utc 时间?

javascript - 如何在各种浏览器中以用户本地时间显示我的 javascript 日期对象?

Python:将字符串中的多个日期格式更改为日期时间格式

java - 2 个物体之间的角度

game-maker - 如何在最后一帧卡住 Sprite 动画?

Java 扩展将位图(图像)作为字节数组返回为字符串,我需要在我的游戏中显示图像。如何?

python - 在两列上分组并使用 pandas - Python 在特定列上应用转换(分区)、滚动和连接

javascript - 在javascript中将毫秒字符串转换为日期