幻想森林

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1761|回复: 3

[RM2K&2K3] 帮忙看看这个脚本是什么意思,有几句不懂

[复制链接]

6

主题

19

帖子

211

积分

③业余

积分
211
发表于 2007-4-2 17:27:09 | 显示全部楼层 |阅读模式
原脚本是:
#==============================================================================
# ■ Window_BattleStatus
#------------------------------------------------------------------------------
#  显示战斗画面同伴状态的窗口。
#==============================================================================

class Window_BattleStatus < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #--------------------------------------------------------------------------
  def initialize
    super(0, 320, 640, 160)
    self.contents = Bitmap.new(width - 32, height - 32)
    @level_up_flags = [false, false, false, false]
    #........................................................................
    self.opacity = 0
    @sta_back = []   
    @sta_output = []
    @cp_output = [] 这几句是什么意思是设数组吗
    @hp_bitmap = RPG::Cache.picture("../system/battle/hmcp/hp_bar.png")
    @mp_bitmap = RPG::Cache.picture("../system/battle/hmcp/mp_bar.png")
    @cp_bitmap = RPG::Cache.picture("../system/battle/hmcp/cp_bar.png")
    @cp_output = []
    @cp_back_bar = Sprite.new
    @cp_back_bar.bitmap = Bitmap.new("Graphics/system/battle/hmcp/cp_back_bar")
    @cp_back_bar.x = 450
    @cp_back_bar.y = 25
    @cp_back_bar.z = self.z + 1
    @actor_cp_sprite = []
    @actor_cp_sprite_back = []
    for actor in $game_party.actors
      @actor_cp_sprite[actor.index] = Sprite.new
      @actor_cp_sprite[actor.index].bitmap = Bitmap.new("Graphics/system/battle/hmcp/sprite/" + actor.name)
      @actor_cp_sprite[actor.index].x = 450
      @actor_cp_sprite[actor.index].y = 25 - 20
      @actor_cp_sprite[actor.index].z = 102
      @actor_cp_sprite_back[actor.index] = Sprite.new
      @actor_cp_sprite_back[actor.index].bitmap = Bitmap.new("Graphics/system/battle/hmcp/cp_sprite")
      @actor_cp_sprite_back[actor.index].x = 450
      @actor_cp_sprite_back[actor.index].y = 25
      @actor_cp_sprite_back[actor.index].z = 102
    end
    for actor_index in 1..$game_party.actors.size
      @cp_output[actor_index] = Sprite.new
      @cp_output[actor_index].bitmap = Bitmap.new(133, 78)
      @cp_output[actor_index].x = 100 + (actor_index - 1) * 133
      @cp_output[actor_index].y = 480 - 78 - 10
      @cp_output[actor_index].z = self.z + 2
      @cp_output[actor_index].bitmap.clear还有这句是什么意思
      @sta_back[actor_index] = Sprite.new
      @sta_back[actor_index].bitmap = Bitmap.new("Graphics/System/Battle/sta_back/" + $game_party.actors[actor_index - 1].name + "_sta.png")
      @sta_back[actor_index].x = 100 + (actor_index - 1) * 133
      @sta_back[actor_index].y = 480 - 78 - 10
      @sta_back[actor_index].z = self.z + 1
      @sta_output[actor_index] = Sprite.new
      @sta_output[actor_index].bitmap = Bitmap.new(133, 78)
      @sta_output[actor_index].x = 100 + (actor_index - 1) * 133
      @sta_output[actor_index].y = 480 - 78 - 10
      @sta_output[actor_index].z = self.z + 2
      @sta_output[actor_index].bitmap.clear
      @sta_output[actor_index].bitmap.font.size = 10
      @sta_output[actor_index].bitmap.font.name = "黑体"
      hp_width = $game_party.actors[actor_index - 1].hp * @hp_bitmap.width/$game_party.actors[actor_index - 1].maxhp
      hp_rect = Rect.new(0, 0, hp_width, 3)
      mp_width = $game_party.actors[actor_index - 1].sp * @mp_bitmap.width/$game_party.actors[actor_index - 1].maxsp
      mp_rect = Rect.new(0, 0, mp_width, 3)
      @sta_output[actor_index].bitmap.blt(66, 44, @hp_bitmap, hp_rect)
      @sta_output[actor_index].bitmap.blt(66, 64, @mp_bitmap, mp_rect)
      @sta_output[actor_index].bitmap.font.color.set(255, 0, 0)
      @sta_output[actor_index].bitmap.draw_text(80, 31, 77, 11,$game_party.actors[actor_index - 1].hp.to_s + "/" + $game_party.actors[actor_index - 1].maxhp.to_s)
      @sta_output[actor_index].bitmap.font.color.set(0, 0, 255)
      @sta_output[actor_index].bitmap.draw_text(80, 51, 77, 11,$game_party.actors[actor_index - 1].sp.to_s + "/" + $game_party.actors[actor_index - 1].maxsp.to_s)
    end
    #........................................................................
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 释放
  #--------------------------------------------------------------------------
  def dispose
    super
    @hp_bitmap.bitmap.dispose
    @hp_bitmap.dispose
    @mp_bitmap.bitmap.dispose
    @mp_bitmap.dispose
    @cp_bitmap.bitmap.dispose
    @cp_bitmap.dispose
    for actor_index in 1..$game_party.actors.size
      @sta_back[actor_index].bitmap.dispose
      @sta_back[actor_index].dispose
      @sta_output[actor_index].bitmap.dispose
      @sta_output[actor_index].dispose
      @cp_output[actor_index].bitmap.dispose
      @cp_output[actor_index].dispose
    end
  end
  #--------------------------------------------------------------------------
  # ● 设置升级标志
  #     actor_index : 角色索引
  #--------------------------------------------------------------------------
  def level_up(actor_index)
    @level_up_flags[actor_index] = true
  end
  #......................................................................
  #--------------------------------------------------------------------------
  # ● 设置正在攻击标志
  #     actor_index : 角色索引
  #--------------------------------------------------------------------------
  def in_atk(actor_index)
    @sta_back[actor_index + 1].bitmap = Bitmap.new("Graphics/System/Battle/sta_back/" + $game_party.actors[actor_index].name + "_sta_atk.png")
  end
  #--------------------------------------------------------------------------
  # ● 设置不在攻击标志
  #     actor_index : 角色索引
  #--------------------------------------------------------------------------
  def out_atk(actor_index)
    @sta_back[actor_index + 1].bitmap = Bitmap.new("Graphics/System/Battle/sta_back/" + $game_party.actors[actor_index].name + "_sta.png")
  end
  #......................................................................
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      actor = $game_party.actors
      #......................................................................
      actor_x = i * 133 + 100
      @sta_output[i + 1].bitmap.clear当然还有这句也不懂。
      hp_width = $game_party.actors.hp * @hp_bitmap.width/$game_party.actors.maxhp
      hp_rect = Rect.new(0, 0, hp_width, 3)
      mp_width = $game_party.actors.sp * @mp_bitmap.width/$game_party.actors.maxsp
      mp_rect = Rect.new(0, 0, mp_width, 3)
      @sta_output[i + 1].bitmap.blt(66, 44, @hp_bitmap, hp_rect)
      @sta_output[i + 1].bitmap.blt(66, 64, @mp_bitmap, mp_rect)
      @sta_output[i + 1].bitmap.font.color.set(255, 0, 0)
      @sta_output[i + 1].bitmap.draw_text(80, 31, 77, 11,$game_party.actors.hp.to_s + "/" + $game_party.actors.maxhp.to_s)
      @sta_output[i + 1].bitmap.font.color.set(0, 0, 255)
      @sta_output[i + 1].bitmap.draw_text(80, 51, 77, 11,$game_party.actors.sp.to_s + "/" + $game_party.actors.maxsp.to_s)
      #......................................................................
      if @level_up_flags
        self.contents.font.color = normal_color
        self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
      else
        draw_actor_state(actor, actor_x, 96)
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 刷新画面
  #--------------------------------------------------------------------------
  def update
    super
    # 主界面的不透明度下降
    if $game_temp.battle_main_phase
      self.contents_opacity -= 4 if self.contents_opacity > 191
    else
      self.contents_opacity += 4 if self.contents_opacity < 255
    end
  end
end
高手们帮帮忘 [s:1]
回复

使用道具 举报

88

主题

5419

帖子

214748万

积分

版主

S素世上最伟大最华丽

Rank: 7Rank: 7Rank: 7

积分
2147483647
QQ
发表于 2007-4-2 18:25:25 | 显示全部楼层
clear
清除位图全体。
回复 支持 反对

使用道具 举报

89

主题

2333

帖子

3273万

积分

⑧专业

Xavier on Rails

积分
32739794
QQ
发表于 2007-4-3 19:38:22 | 显示全部楼层
前两个都是创建一个空数组没错
后面两个是清除数组中第[x]项的内容
回复 支持 反对

使用道具 举报

6

主题

19

帖子

211

积分

③业余

积分
211
 楼主| 发表于 2007-4-5 09:07:23 | 显示全部楼层
ytyt谢谢各位朋友, [s:1]
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|幻想森林

GMT+8, 2025-6-24 06:03 , Processed in 0.011894 second(s), 22 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表