ISA - 头顶的东西
#______________________________________________________________________________# * 此脚本归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["头顶的东西"] = System["头顶的东西"] = {}end#--------------------------------------------------------------------------# ● 设定部分#--------------------------------------------------------------------------module ISA# 窗口的坐标修正设定System["头顶的东西"]["坐标修正设定"] = end#==============================================================================# ■ Game_Temp#------------------------------------------------------------------------------# 在没有存档的情况下,处理临时数据的类。这个类的实例请参考# $game_temp 。#==============================================================================class Game_Temp#--------------------------------------------------------------------------# ● 定义实例变量#--------------------------------------------------------------------------attr_accessor :map_put_on # 地图头顶存在图标attr_accessor :map_put_name # 地图头顶存在图标文件名end#==============================================================================# ■ Window_Put_On#------------------------------------------------------------------------------# 显示图标的窗口。#==============================================================================class Window_Put_On < Window_Baseinclude 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["头顶的东西"]["坐标修正设定"] self.y = $game_player.screen_y - System["头顶的东西"]["坐标修正设定"] self.z = 0 @name = name refreshend#--------------------------------------------------------------------------# ● 刷新#--------------------------------------------------------------------------def refresh self.contents.clear bitmap = RPG::Cache.icon(@name) self.contents.blt(0, 0, bitmap, Rect.new(0, 0, 24, 24))end#--------------------------------------------------------------------------# ● 刷新画面#--------------------------------------------------------------------------def update super self.x = $game_player.screen_x - System["头顶的东西"]["坐标修正设定"] self.y = $game_player.screen_y - System["头顶的东西"]["坐标修正设定"]endend#==============================================================================# ■ Scene_Map#------------------------------------------------------------------------------# 处理地图画面的类。#==============================================================================class Scene_Mapinclude ISA #--------------------------------------------------------------------------# ● 主处理#--------------------------------------------------------------------------alias :put_on_the_thing_main :main unless method_defined? :put_on_the_thing_maindef main @put_on_window = Window_Put_On.new($game_temp.map_put_name) if $game_temp.map_put_on put_on_the_thing_main @put_on_window.dispose if @put_on_window != nilend#--------------------------------------------------------------------------# ● 刷新画面#--------------------------------------------------------------------------alias :put_on_the_thing_update :update unless method_defined? :put_on_the_thing_updatedef update @put_on_window.update if @put_on_window != nil put_on_the_thing_updateend#--------------------------------------------------------------------------# ● 设置图标#--------------------------------------------------------------------------def set_icon(name) @put_on_window = Window_Put_On.new(name) @put_on_window.visible = true $game_temp.map_put_on = true $game_temp.map_put_name = nameend#--------------------------------------------------------------------------# ● 图标关闭#--------------------------------------------------------------------------def set_icon_no $game_temp.map_put_on = false if @put_on_window != nil @put_on_window.visible = false end return trueendend复制代码使用方法?事件脚本。
$scene.set_icon(name), # 范例:$scene.set_icon(“001-Weapon”)
$scene.set_icon_no,# 取消显示
适合某些特殊用途……
关于坐标:脚本设定部分的数组,前一个是x,后一个是y。
截图神马的……
本帖来自P1论坛作者忧雪の伤,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=170122若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。
页:
[1]