Project1
标题:
请教关于游戏时间的设置
[打印本页]
作者:
wangjile
时间:
2008-11-27 08:18
提示:
作者被禁止或删除 内容自动屏蔽
作者:
淘金鸭
时间:
2008-11-29 18:15
class Window_1 < Window_Base
def initialize
super(0, 0, 640,100)
self.contents = Bitmap.new(width-32, height-32)
self.contents.font.name = "黑体"
self.contents.font.size = 20
refresh
end
def refresh
self.contents.clear
self.contents.font.color = text_color(6)
self.contents.draw_text(0, 0, 100, 32, "游戏时间:")
#显示游戏时间 (从 Window_PlayTime中Copy来)
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
text = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(100, 0, 120, 32, text)
# 结束显示游戏时间的编码
self.contents.font.color = text_color(6)
self.contents.draw_text(250, 0, 50, 32, "金钱:")
self.contents.font.color = text_color(0)
self.contents.draw_text(305, 0, 100, 32, $game_party.gold.to_s)
self.contents.font.color = text_color(6)
self.contents.draw_text(400, 0, 100, 32, "地图ID:")
self.contents.font.color = text_color(0)
self.contents.draw_text(480, 0, 100, 32, $game_map.map_id.to_s)
end
def update
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end
class Window_2 < Window_Base
def initialize
super(0, 0, 200,380)
self.contents = Bitmap.new(width-32, height-32)
self.contents.font.name = "黑体"
self.contents.font.size = 20
for i in 0...$game_party.actors.size
x = 0
y = i * 90
actor = $game_party.actors[i]
self.contents.font.color = text_color(6)
self.contents.draw_text(x, y, 200, 32, actor.name)
self.contents.font.color = text_color(4)
self.contents.draw_text(x, y+32, 200, 32, actor.class_name)
end
end
end
class Window_3 < Window_Base
def initialize
super(0, 0, 440,380)
self.contents = Bitmap.new(width-32, height-32)
self.contents.font.name = "黑体"
self.contents.font.size = 20
for i in 0...$game_party.actors.size
x = 0
y = i * 150
if i >= 2
x=250
y-=300
end
actor = $game_party.actors[i]
self.contents.font.color = text_color(6)
self.contents.draw_text(x, y, 200, 32, actor.name)
offset_x=contents.text_size(actor.name).width+10
self.contents.font.color = text_color(4)
self.contents.draw_text(x+offset_x, y, 200, 32, "Lv: " + actor.level.to_s)
draw_actor_hp(actor, x, y+32)
draw_actor_sp(actor, x, y+64)
draw_actor_exp(actor, x, y+96)
end
end
end
class Scene_Chapter_2
def main
@window_1=Window_1.new
@window_2=Window_2.new
@window_2.y=100
@window_3=Window_3.new
@window_3.x=200
@window_3.y=100
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@window_1.dispose
@window_2.dispose
@window_3.dispose
end
def update
@window_1.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
end
end
end
复制代码
你可以参考这段脚本
作者:
wangjile
时间:
2008-11-30 05:48
提示:
作者被禁止或删除 内容自动屏蔽
作者:
菜鸟飞呀飞
时间:
2008-12-11 21:03
提示:
作者被禁止或删除 内容自动屏蔽
作者:
wangjile
时间:
2008-12-12 13:28
提示:
作者被禁止或删除 内容自动屏蔽
作者:
菜鸟飞呀飞
时间:
2008-12-12 15:55
提示:
作者被禁止或删除 内容自动屏蔽
作者:
wangjile
时间:
2008-12-13 13:17
提示:
作者被禁止或删除 内容自动屏蔽
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1