Project1
标题:
帮忙写个窗口描绘物品图标,并随主角移动而移动的脚本?
[打印本页]
作者:
18229042
时间:
2011-3-18 20:41
提示:
作者被禁止或删除 内容自动屏蔽
作者:
忧雪の伤
时间:
2011-3-18 20:57
本帖最后由 忧雪の伤 于 2011-3-18 21:05 编辑
class Window_Icon < Window_Base
def initialize(name)
super(0, 0, 64, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
@name = name
refresh
end
def refresh
self.contents.clear
bitmap = RPG::Cache.icon(@name)
self.contents.blt(0, 0, bitmap, Rect.new(0, 0, 24, 24))
end
end
class Scene_Map
alias :old_old_main :main unless method_defined? :old_old_main
def main
old_old_main
@icon_window.dispose if @icon_window != nil
end
alias :old_old_update :update unless method_defined? :old_old_update
def update
if @icon_window != nil
@icon_window.x = $game_player.screen_x - 30
@icon_window.y = $game_player.screen_y - 82
end
old_old_update
end
def set_icon(name)
@icon_window = Window_Icon.new(name) if name != nil
end
end
复制代码
作者:
18229042
时间:
2011-3-18 21:11
提示:
作者被禁止或删除 内容自动屏蔽
作者:
忧雪の伤
时间:
2011-3-19 12:14
本帖最后由 忧雪の伤 于 2011-3-19 13:06 编辑
#______________________________________________________________________________
# * 此脚本归66RPG - Idiot Script Association(ISA)所有,谢绝任何形式转载。
#______________________________________________________________________________
#==============================================================================
# ■ 头顶的东西 - Put On The Thing
#------------------------------------------------------------------------------
# 遵守协议:66RPG - Idiot Script Association(ISA)
# 初始脚本:忧雪の伤
# 更新优化:无
# 当前版本:1.0.0.0
#------------------------------------------------------------------------------
# 更新日记:忧雪の伤(2011.3.19)
# - 初始化对象
#------------------------------------------------------------------------------
# 功能介绍:创建一个可以跟随移动,指定文件,显示在Player头上的Icon。
# 使用方法:插入接入包的下端处。
# 存在问题:无
#==============================================================================
#--------------------------------------------------------------------------
# ● 资料记录
#--------------------------------------------------------------------------
module ISA
Use["头顶的东西"] = [true, "1.0.0.0"]
System["头顶的东西"] = {}
end
#--------------------------------------------------------------------------
# ● 设定部分
#--------------------------------------------------------------------------
module ISA
# 窗口的坐标修正设定
System["头顶的东西"]["坐标修正设定"] = [30, 82]
end
#==============================================================================
# ■ Window_Put_On
#------------------------------------------------------------------------------
# 显示图标的窗口。
#==============================================================================
class Window_Put_On < Window_Base
include ISA
#--------------------------------------------------------------------------
# ● 初始化窗口
#--------------------------------------------------------------------------
def initialize(name)
super(0, 0, 64, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
self.x = $game_player.screen_x - System["头顶的东西"]["坐标修正设定"][0]
self.y = $game_player.screen_y - System["头顶的东西"]["坐标修正设定"][1]
self.z = 0
@name = name
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
bitmap = RPG::Cache.icon(@name)
self.contents.blt(0, 0, bitmap, Rect.new(0, 0, 24, 24))
end
end
#==============================================================================
# ■ Scene_Map
#------------------------------------------------------------------------------
# 处理地图画面的类。
#==============================================================================
class Scene_Map
include ISA
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
alias :put_on_the_thing_main :main unless method_defined? :put_on_the_thing_main
def main
put_on_the_thing_main
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
alias :put_on_the_thing_update :update unless method_defined? :put_on_the_thing_update
def update
if @put_on_window != nil
@put_on_window.visible = true
@put_on_window.x = $game_player.screen_x - System["头顶的东西"]["坐标修正设定"][0]
@put_on_window.y = $game_player.screen_y - System["头顶的东西"]["坐标修正设定"][1]
end
put_on_the_thing_update
end
#--------------------------------------------------------------------------
# ● 设置图标
#--------------------------------------------------------------------------
def set_icon(name)
@put_on_window = Window_Put_On.new(name)
@put_on_window.visible = true
end
#--------------------------------------------------------------------------
# ● 图标关闭
#--------------------------------------------------------------------------
def set_icon_no
if @put_on_window != nil
@put_on_window.visible = false
end
return true
end
end
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1