加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
等待N秒
$game_variables[19] += 1
if $game_variables[19] == 60
$game_variables[20] += 1
end
if $game_variables[20] == 24
$game_variables[21] += 1
end
如您所见,这是时钟。
我之前是把PlayTime改成时钟。也解决了归零问题。
新的问题是不能加时间。
假设我去旅店睡觉经过多少时间,加进时钟里。
所以我想用变量来表示,操作起来应该更方便。
您可能觉得这可以用公共事件来等待N真执行。
但是公共事件并非一直都是运行的,有些情况下是不动的,比如战斗。
我把$game_variables[19] = 1放到
def refresh self.contents.clear self.contents.font.color = system_color self.contents.draw_text(4, 0, 120, 32, "游戏时间") @total_sec = Graphics.frame_count / Graphics.frame_rate min = @total_sec / 60 % 24 sec = @total_sec % 60 $game_variables[19] = 1 text = sprintf("%02d时%02d分", min, sec) self.contents.font.color = normal_color self.contents.draw_text(4, 32, 120, 32, text, 2) end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, "游戏时间")
@total_sec = Graphics.frame_count / Graphics.frame_rate
min = @total_sec / 60 % 24
sec = @total_sec % 60
$game_variables[19] = 1
text = sprintf("%02d时%02d分", min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, text, 2)
end
这样并没有效果。只有在游戏中执行def refresh时才会有效果。 |