Project1

标题: 系统菜单里的光标矩形如何改箭头光标? [打印本页]

作者: 雪风    时间: 2007-12-23 08:24
标题: 系统菜单里的光标矩形如何改箭头光标?
比如Window_Target里

使用全体效果的技能或者道具

整一块大光标  很难看

很想这里更改成战斗时指向型箭头光标

但知识太贫乏    自己试着改了很久都不成功

往达人指点  

推荐我有此类改动的未加密游戏也成{/ll}
作者: 雪风    时间: 2007-12-23 08:24
标题: 系统菜单里的光标矩形如何改箭头光标?
比如Window_Target里

使用全体效果的技能或者道具

整一块大光标  很难看

很想这里更改成战斗时指向型箭头光标

但知识太贫乏    自己试着改了很久都不成功

往达人指点  

推荐我有此类改动的未加密游戏也成{/ll}
作者: 訫﹎森    时间: 2007-12-23 10:57
http://rpg.blue/web/htm/news329.htm
内容为
、找到你需要修改的窗口的def initialize
在super(.....)下面一行添加:
@sp_rect = Sprite.new
@sp_rect.bitmap = Bitmap.new("图片光标.png")
@sp_rect.x = self.x
@sp_rect.y = self.y
@sp_rect.z = self.z + 1

2、找到窗口的  def update_cursor_rect
找到里面的self.cursor_rect.empty这行,删掉,下面添加:@sp_rect.opacity = 0
找到里面的这种self.cursor_rect.set(参数1,参数2,参数3,参数4);删此行,改为
@sp_rect.x = self.x + 参数1
@sp_rect.y = self.y + 参数2

3、新添:
def dispose
super
@sp_rect.dispose
end

这样就OK了。这里提供一个完整脚本,可以直接使用,效果是修改了状态菜单。注意给测试工程的根目录下放一个“光标图片.png”。
  1. #==============================================================================
  2. # ■ Window_MenuStatus
  3. #------------------------------------------------------------------------------
  4. #  显示菜单画面和同伴状态的窗口。
  5. #==============================================================================

  6. class Window_MenuStatus < Window_Selectable
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化目标
  9.   #--------------------------------------------------------------------------
  10.   def initialize
  11.     super(0, 0, 480, 480)
  12.     @sp_rect = Sprite.new
  13.     @sp_rect.bitmap = Bitmap.new("光标图片.png")
  14.     @sp_rect.x = self.x
  15.     @sp_rect.y = self.y
  16.     @sp_rect.z = self.z + 1
  17.     self.contents = Bitmap.new(width - 32, height - 32)
  18.     refresh
  19.     self.active = false
  20.     self.index = -1
  21.   end
  22.   #--------------------------------------------------------------------------
  23.   # ● 刷新
  24.   #--------------------------------------------------------------------------
  25.   def refresh
  26.     self.contents.clear
  27.     @item_max = $game_party.actors.size
  28.     for i in 0...$game_party.actors.size
  29.       x = 64
  30.       y = i * 116
  31.       actor = $game_party.actors[i]
  32.       draw_actor_graphic(actor, x - 40, y + 80)
  33.       draw_actor_name(actor, x, y)
  34.       draw_actor_class(actor, x + 144, y)
  35.       draw_actor_level(actor, x, y + 32)
  36.       draw_actor_state(actor, x + 90, y + 32)
  37.       draw_actor_exp(actor, x, y + 64)
  38.       draw_actor_hp(actor, x + 236, y + 32)
  39.       draw_actor_sp(actor, x + 236, y + 64)
  40.     end   
  41.     @sp_rect.x = self.x
  42.     @sp_rect.y = self.y
  43.     @sp_rect.z = self.z + 1
  44.   end
  45.   #--------------------------------------------------------------------------
  46.   # ● 刷新光标矩形
  47.   #--------------------------------------------------------------------------
  48.   def update_cursor_rect
  49.     if @index < 0
  50.       @sp_rect.opacity = 0
  51.     else
  52.       @sp_rect.opacity = 255
  53.       @sp_rect.x = self.x + 0
  54.       @sp_rect.y = self.y + @index * 116
  55.     end
  56.   end
  57.   def dispose
  58.     super
  59.     @sp_rect.dispose
  60.   end
  61. end



复制代码

其实只要耐心的在主站上找一下,许多简单的问题都能决绝{/hx}




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1