Project1
标题:
帮我看下我的变量显示脚本,顺便修改(很不厚道的抄某高手的
[打印本页]
作者:
18229042
时间:
2011-2-15 16:48
提示:
作者被禁止或删除 内容自动屏蔽
作者:
一箭烂YiJL
时间:
2011-2-15 22:03
看到这么多XE的fu字眼,就知道是Fux2所为。
对着这么多这些XE的fu字眼,当然要消除。(于是不帮LZ兼容了,于是写了三个。)
因为不知道LZ要的时间是实际时间还是游戏累计时间,于是两个都发上来。
累计游戏时间是从我写的这个脚本教程里拿出来的:
http://rpg.blue/forum.php?mod=viewthread&tid=162597
复制代码
(不妨看看。脚本在这儿:)
累计游戏时间:
class Scene_Map
alias:old_start:start
def start
old_start
@time_window = Play_Time.new(0,0)
@time_window.x = 544 - @time_window.width
@time_window.y = 416 - @time_window.height
end
alias:old_update:update
def update
@time_window.update
old_update
end
alias:old_ter:terminate
def terminate
old_ter
@time_window.dispose
end
end
class Play_Time < Window_Base
def initialize(x, y, w = 200, h = 50)
super(x, y, w, h)
refresh
end
def update
super
sec = (Graphics.frame_count / Graphics.frame_rate) % 60
if sec > @total_sec % 60 or sec == 0
refresh
end
end
def refresh
self.contents.clear
@total_sec = Graphics.frame_count / Graphics.frame_rate
draw_playtime(0, 0, width - 32)
end
def draw_playtime(x, y, width)
hrs = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
playtime = sprintf("%02d:%02d:%02d", hrs, min, sec)
playtime = "游戏时间:#{playtime}"
self.contents.font.color = normal_color
self.contents.draw_text(x, -5, width - 2, WLH, playtime, 2)
end
end
复制代码
现在时间:
class Scene_Map
alias:old_start:start
def start
old_start
@time_window = Time.new(0,0)
@time_window.x = 544 - @time_window.width
@time_window.y = 416 - @time_window.height
end
alias:old_update:update
def update
@time_window.update
old_update
end
alias:old_ter:terminate
def terminate
old_ter
@time_window.dispose
end
end
class Time < Window_Base
def initialize(x, y, w = 200, h = 50)
super(x, y, w, h)
update
end
def update
super
self.contents.clear
time = "#{Time.now.mday}日#{Time.now.hour%12}时#{Time.now.min}分#{Time.now.sec}秒"
self.contents.draw_text(0, -5, width - 2, WLH, time)
end
end
复制代码
累计游戏时间和现在时间二选一,互不兼容
(是我特意的)
这个就是
角色1血条
(非常简(陋)的):
class Scene_Map
alias:old_old_start:start
def start
old_old_start
@actor_hp = Actor_hp.new(0,0)
end
alias:old_old_update:update
def update
@actor_hp.update
old_old_update
end
alias:old_old_ter:terminate
def terminate
old_old_ter
@actor_hp.dispose
end
end
class Actor_hp < Window_Base
def initialize(x, y, w = 160, h = 50)
super(x, y, w, h)
update
end
def update
super
self.contents.clear
actor = $game_actors[1]
draw_actor_hp(actor, 0, -7)
end
end
复制代码
原理和时间那个相同,但是我把他们兼容了。
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1