| 
 
| 赞 | 1 |  
| VIP | 246 |  
| 好人卡 | 87 |  
| 积分 | 1 |  
| 经验 | 34142 |  
| 最后登录 | 2015-1-15 |  
| 在线时间 | 323 小时 |  
 Lv1.梦旅人 
	梦石0 星屑55 在线时间323 小时注册时间2010-8-21帖子666 | 
| 看来lz多多少少懂点脚本,就写写过程: 
 Window_MenuStatus中可以发现有行
 draw_actor_graphic(actor, x - 40, y + 80)
 draw_actor_graphic的定义lz可以看看它父类的定义
 2个参数,x,y
 你需要y坐标在选中,即
 @index = 角色在队伍编号  时
 y坐标 = y + 79
 否则
 y坐标 = y + 80
 
 
 可以了解,行走图占了 1*1.5的地图格(默认),为兼容大图,设为64*96
 
 为提高效率,这点对于游戏程序尤为重要,所以采用局部刷新.
 所以建立新的实例变量@index_old,用来记录原来的位置..实例变量初始就是nil值,这就可以偷下懒..
 
 在原来
 下面加个复制代码    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(0, @index * 116, self.width - 32, 96)
    end
 refresh_choice if @index != @index_old
refresh_choice if @index != @index_old 
 新建方法 refresh_choice
 这里主要是坐标计算,还有就是清空,
 RMXP默认没有清空像素,只有用填充像素,即fill_rect,在color参数写Color.new(0,0,0,0)就行
 定义如下:
 
 def refresh_choice    color = Color.new(0,0,0,0)    if @index_old      self.contents.fill_rect(0, @index_old*116, 64, 96, color)      draw_actor_graphic($game_party.actors[@index_old], 24, @index_old*116+80)    end    self.contents.fill_rect(0, @index *116, 64, 96, color)    draw_actor_graphic($game_party.actors[@index],     24, @index*116+75)    @index_old = @index  end
def refresh_choice 
    color = Color.new(0,0,0,0) 
    if @index_old 
      self.contents.fill_rect(0, @index_old*116, 64, 96, color) 
      draw_actor_graphic($game_party.actors[@index_old], 24, @index_old*116+80) 
    end 
    self.contents.fill_rect(0, @index *116, 64, 96, color) 
    draw_actor_graphic($game_party.actors[@index],     24, @index*116+75) 
    @index_old = @index 
  end 
1像素太小了,我写了5像素
 
 
 
 Window_MenuStatus现在变成了:
 
 #==============================================================================# ■ Window_MenuStatus#------------------------------------------------------------------------------#  显示菜单画面和同伴状态的窗口。#============================================================================== class Window_MenuStatus < Window_Selectable  #--------------------------------------------------------------------------  # ● 初始化目标  #--------------------------------------------------------------------------  def initialize    super(0, 0, 480, 480)    self.contents = Bitmap.new(width - 32, height - 32)    refresh    self.active = false    self.index = -1  end  #--------------------------------------------------------------------------  # ● 刷新  #--------------------------------------------------------------------------  def refresh    self.contents.clear    @item_max = $game_party.actors.size    for i in 0...$game_party.actors.size      x = 64      y = i * 116      actor = $game_party.actors[i]      draw_actor_graphic(actor, x - 40, y + 80)      draw_actor_name(actor, x, y)      draw_actor_class(actor, x + 144, y)      draw_actor_level(actor, x, y + 32)      draw_actor_state(actor, x + 90, y + 32)      draw_actor_exp(actor, x, y + 64)      draw_actor_hp(actor, x + 236, y + 32)      draw_actor_sp(actor, x + 236, y + 64)    end  end  #--------------------------------------------------------------------------  # ● 刷新光标矩形  #--------------------------------------------------------------------------  def update_cursor_rect    if @index < 0      self.cursor_rect.empty    else      self.cursor_rect.set(0, @index * 116, self.width - 32, 96)    end    refresh_choice if @index != @index_old and @index >= 0  end  #--------------------------------------------------------------------------  # ● 局部刷新  #--------------------------------------------------------------------------  def refresh_choice    color = Color.new(0,0,0,0)    if @index_old      self.contents.fill_rect(0, @index_old*116, 64, 96, color)      draw_actor_graphic($game_party.actors[@index_old], 24, @index_old*116+80)    end    self.contents.fill_rect(0, @index *116, 64, 96, color)    draw_actor_graphic($game_party.actors[@index],     24, @index*116+75)    @index_old = @index  endend
#============================================================================== 
# ■ Window_MenuStatus 
#------------------------------------------------------------------------------ 
#  显示菜单画面和同伴状态的窗口。 
#============================================================================== 
  
class Window_MenuStatus < Window_Selectable 
  #-------------------------------------------------------------------------- 
  # ● 初始化目标 
  #-------------------------------------------------------------------------- 
  def initialize 
    super(0, 0, 480, 480) 
    self.contents = Bitmap.new(width - 32, height - 32) 
    refresh 
    self.active = false 
    self.index = -1 
  end 
  #-------------------------------------------------------------------------- 
  # ● 刷新 
  #-------------------------------------------------------------------------- 
  def refresh 
    self.contents.clear 
    @item_max = $game_party.actors.size 
    for i in 0...$game_party.actors.size 
      x = 64 
      y = i * 116 
      actor = $game_party.actors[i] 
      draw_actor_graphic(actor, x - 40, y + 80) 
      draw_actor_name(actor, x, y) 
      draw_actor_class(actor, x + 144, y) 
      draw_actor_level(actor, x, y + 32) 
      draw_actor_state(actor, x + 90, y + 32) 
      draw_actor_exp(actor, x, y + 64) 
      draw_actor_hp(actor, x + 236, y + 32) 
      draw_actor_sp(actor, x + 236, y + 64) 
    end 
  end 
  #-------------------------------------------------------------------------- 
  # ● 刷新光标矩形 
  #-------------------------------------------------------------------------- 
  def update_cursor_rect 
    if @index < 0 
      self.cursor_rect.empty 
    else 
      self.cursor_rect.set(0, @index * 116, self.width - 32, 96) 
    end 
    refresh_choice if @index != @index_old and @index >= 0 
  end 
  #-------------------------------------------------------------------------- 
  # ● 局部刷新 
  #-------------------------------------------------------------------------- 
  def refresh_choice 
    color = Color.new(0,0,0,0) 
    if @index_old 
      self.contents.fill_rect(0, @index_old*116, 64, 96, color) 
      draw_actor_graphic($game_party.actors[@index_old], 24, @index_old*116+80) 
    end 
    self.contents.fill_rect(0, @index *116, 64, 96, color) 
    draw_actor_graphic($game_party.actors[@index],     24, @index*116+75) 
    @index_old = @index 
  end 
end 
 这样就好了
 | 
 评分
查看全部评分
 |