Project1
标题:
这个代码怎么改地图名字显示的时间?
[打印本页]
作者:
a604682925
时间:
2008-7-3 02:06
提示:
作者被禁止或删除 内容自动屏蔽
作者:
浪使者
时间:
2008-7-3 04:17
它是通过渐进改变透明度来控制窗体显示的时间。。
永久显示地图名的代码: (直接覆盖原代码即可)
#================================================
# ■ Window_Pos
#================================================
class Window_Pos < Window_Base
#------------------------------------------------
# ● 初始化
#------------------------------------------------
def initialize
super(0, 0, 122, 52)
self.z = 151
self.contents.font.size = 20
refresh
end
#------------------------------------------------
# ● 刷新
#------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
@x,@y = $game_player.x,$game_player.y
self.contents.draw_text(0, 0, 90, 20, "(#{@x},#{@y})", 1)
end
#------------------------------------------------
# ● 更新
#------------------------------------------------
def update
return if $game_player.x == @x and $game_player.y == @y
refresh
end
end
#================================================
# ■ Window_MapName
#================================================
class Window_MapName < Window_Base
#------------------------------------------------
# ● 初始化
#------------------------------------------------
def initialize
@map_id = $game_map.map_id
super(0, 0, 182, 52)
self.contents.font.size = 20
self.z = 151
refresh
end
#------------------------------------------------
# ● 刷新
#------------------------------------------------
def refresh
self.opacity = 255
self.contents_opacity = 255
name = $data_mapinfos[@map_id].name
width = self.contents.text_size(name).width
height = self.contents.text_size(name).height
self.width = width + 32
self.height = height + 32
self.contents = Bitmap.new(width, height)
self.contents.font.size = 20
self.x = (Graphics.width - self.width) / 2
self.y = (Graphics.height - self.height) / 2
self.contents.font.color = system_color
self.contents.draw_text(0, 0, width, 20, name, 1)
end
#------------------------------------------------
# ● 更新
#------------------------------------------------
def update
if $game_map.map_id != @map_id
@map_id = $game_map.map_id
refresh
self.opacity = 255
self.contents_opacity = 255
end
return if self.opacity == 0
self.opacity -= 0
self.contents_opacity -= 0
end
end
class Scene_Title < Scene_Base
#------------------------------------------------
# ● 数据库载入
#------------------------------------------------
alias old_ld load_database
def load_database
old_ld
$data_mapinfos = load_data("Data/MapInfos.rvdata")
end
end
class Scene_Map < Scene_Base
#------------------------------------------------
# ● 开始
#------------------------------------------------
alias old_start start
def start
old_start
@pos_window = Window_Pos.new
@mapname_window = Window_MapName.new
end
#------------------------------------------------
# ● 结束
#------------------------------------------------
alias old_ter terminate
def terminate
old_ter
@pos_window.dispose
@mapname_window.dispose
end
#------------------------------------------------
# ● 更新
#------------------------------------------------
alias old_update update
def update
old_update
@pos_window.update
@mapname_window.update
end
end
复制代码
减慢消失地图名的代码:(同样直接覆盖)
#================================================
# ■ Window_Pos
#================================================
class Window_Pos < Window_Base
#------------------------------------------------
# ● 初始化
#------------------------------------------------
def initialize
super(0, 0, 122, 52)
self.z = 151
self.contents.font.size = 20
refresh
end
#------------------------------------------------
# ● 刷新
#------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
@x,@y = $game_player.x,$game_player.y
self.contents.draw_text(0, 0, 90, 20, "(#{@x},#{@y})", 1)
end
#------------------------------------------------
# ● 更新
#------------------------------------------------
def update
return if $game_player.x == @x and $game_player.y == @y
refresh
end
end
#================================================
# ■ Window_MapName
#================================================
class Window_MapName < Window_Base
#------------------------------------------------
# ● 初始化
#------------------------------------------------
def initialize
@map_id = $game_map.map_id
super(0, 0, 182, 52)
self.contents.font.size = 20
self.z = 151
refresh
end
#------------------------------------------------
# ● 刷新
#------------------------------------------------
def refresh
self.opacity = 255
self.contents_opacity = 255
name = $data_mapinfos[@map_id].name
width = self.contents.text_size(name).width
height = self.contents.text_size(name).height
self.width = width + 32
self.height = height + 32
self.contents = Bitmap.new(width, height)
self.contents.font.size = 20
self.x = (Graphics.width - self.width) / 2
self.y = (Graphics.height - self.height) / 2
self.contents.font.color = system_color
self.contents.draw_text(0, 0, width, 20, name, 1)
end
#------------------------------------------------
# ● 更新
#------------------------------------------------
def update
if $game_map.map_id != @map_id
@map_id = $game_map.map_id
refresh
self.opacity = 255
self.contents_opacity = 255
end
return if self.opacity == 0
self.opacity -= 1
self.contents_opacity -= 1
end
end
class Scene_Title < Scene_Base
#------------------------------------------------
# ● 数据库载入
#------------------------------------------------
alias old_ld load_database
def load_database
old_ld
$data_mapinfos = load_data("Data/MapInfos.rvdata")
end
end
class Scene_Map < Scene_Base
#------------------------------------------------
# ● 开始
#------------------------------------------------
alias old_start start
def start
old_start
@pos_window = Window_Pos.new
@mapname_window = Window_MapName.new
end
#------------------------------------------------
# ● 结束
#------------------------------------------------
alias old_ter terminate
def terminate
old_ter
@pos_window.dispose
@mapname_window.dispose
end
#------------------------------------------------
# ● 更新
#------------------------------------------------
alias old_update update
def update
old_update
@pos_window.update
@mapname_window.update
end
end
复制代码
[LINE]1,#dddddd[/LINE]
系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
作者:
a604682925
时间:
2008-7-3 07:35
提示:
作者被禁止或删除 内容自动屏蔽
作者:
浪使者
时间:
2008-7-3 21:13
可以,你重新发个新帖吧。。
写清楚你是要把“地图名显示”的位置放到坐标位置,替换掉坐标,只显示地图名,
还是在原显示坐标的位置,把“地图名显示”和坐标显示放到一块里。。
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1