查看: 1211|回复: 3

请问如何把游戏时间和步数在同一个框里显示?

  [复制链接]
梦石
0
星屑
50
在线时间
35 小时
注册时间
2008-1-6
回帖
113
发表于 2008-4-13 01:59:37 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
请问如何把游戏时间和步数在同一个框里显示?
版务信息:本贴由楼主自主结贴~

茄孓

梦石
0
星屑
76
在线时间
140 小时
注册时间
2007-5-29
回帖
820
发表于 2008-4-13 02:16:09 | 显示全部楼层
修改一下窗口内容
系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
回复

使用道具 举报

茄孓

梦石
0
星屑
76
在线时间
140 小时
注册时间
2007-5-29
回帖
820
发表于 2008-4-13 02:20:04 | 显示全部楼层
把这个脚本放到main前就可以合起来了
  1. class Window_Steps < Window_Base
  2.   def initialize
  3.     super(0, 0, 160, 96)
  4.     self.contents = Bitmap.new(width - 32, height - 32)
  5.     self.opacity = 0
  6.     self.back_opacity = 0
  7.     refresh
  8.   end
  9.   def refresh
  10.     self.contents.clear
  11.   end
  12. end
  13. class Window_PlayTime < Window_Base
  14.   def initialize
  15.     super(0, 0, 160, 192)
  16.     self.contents = Bitmap.new(width - 32, height - 32)
  17.     refresh
  18.   end
  19.   def refresh
  20.     self.contents.clear
  21.     self.contents.font.color = system_color
  22.     self.contents.draw_text(4, 0, 120, 32, "游戏时间")
  23.     @total_sec = Graphics.frame_count / Graphics.frame_rate
  24.     hour = @total_sec / 60 / 60
  25.     min = @total_sec / 60 % 60
  26.     sec = @total_sec % 60
  27.     text = sprintf("%02d:%02d:%02d", hour, min, sec)
  28.     self.contents.font.color = normal_color
  29.     self.contents.draw_text(4, 32, 120, 32, text, 2)
  30.     self.contents.font.color = system_color
  31.     self.contents.draw_text(4, 0+80, 120, 32, "步数")
  32.     self.contents.font.color = normal_color
  33.     self.contents.draw_text(4, 32+80, 120, 32, $game_party.steps.to_s, 2)
  34.   end
  35.   def update
  36.     super
  37.     if Graphics.frame_count / Graphics.frame_rate != @total_sec
  38.       refresh
  39.     end
  40.   end
  41. end
复制代码
回复

使用道具 举报

梦石
0
星屑
50
在线时间
35 小时
注册时间
2008-1-6
回帖
113
 楼主| 发表于 2008-4-13 23:02:26 | 显示全部楼层
虽然我自己已经解决了!但还是谢谢~~{/tp}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部