设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
12
返回列表 发新帖
楼主: 蓝翎
打印 上一主题 下一主题

问几个新手问题

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-4-8
帖子
33
11
发表于 2008-7-16 03:31:01 | 只看该作者
  1. #==============================================================================
  2. # ■ Window_BattleStatus
  3. #------------------------------------------------------------------------------
  4. #  显示战斗画面同伴状态的窗口。
  5. #==============================================================================

  6. class Window_BattleStatus < Window_Base
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #--------------------------------------------------------------------------
  10.   def initialize
  11.     super(0, 320, 640, 160)
  12.     self.contents = Bitmap.new(width - 32, height - 32)
  13.     @level_up_flags = [false, false, false, false]
  14.     #........................................................................
  15.     self.opacity = 0
  16.     @sta_back = []
  17.     @sta_output = []
  18.     @cp_output = []
  19.     @hp_bitmap = RPG::Cache.picture("../system/battle/hmcp/hp_bar.png")
  20.     @mp_bitmap = RPG::Cache.picture("../system/battle/hmcp/mp_bar.png")
  21.     @cp_bitmap = RPG::Cache.picture("../system/battle/hmcp/cp_bar.png")
  22.     @cp_output = []
  23.     @cp_back_bar = Sprite.new
  24.     @cp_back_bar.bitmap = Bitmap.new("Graphics/system/battle/hmcp/cp_back_bar")
  25.     @cp_back_bar.x = 450
  26.     @cp_back_bar.y = 25
  27.     @cp_back_bar.z = self.z + 1
  28.     @actor_cp_sprite = []
  29.     @actor_cp_sprite_back = []
  30.       @enemy_cp_sprite = []
  31.     @enemy_cp_sprite_back = []
  32.     @enemy_cp_sprite_count = []
  33.     for actor in $game_troop.enemies
  34.       next if !actor.exist?
  35.       @enemy_cp_sprite_count.push(actor.index)
  36.       @enemy_cp_sprite[actor.index] = Sprite.new
  37.       @enemy_cp_sprite[actor.index].bitmap = Bitmap.new("Graphics/system/battle/hmcp/sprite/" + actor.name)
  38.       @enemy_cp_sprite[actor.index].x = 450
  39.       @enemy_cp_sprite[actor.index].y = 25 + 11
  40.       @enemy_cp_sprite[actor.index].z = 102
  41.       
  42.     end
  43.     for actor in $game_party.actors
  44.       @actor_cp_sprite[actor.index] = Sprite.new
  45.       @actor_cp_sprite[actor.index].bitmap = Bitmap.new("Graphics/system/battle/hmcp/sprite/" + actor.name)
  46.       @actor_cp_sprite[actor.index].x = 450
  47.       @actor_cp_sprite[actor.index].y = 200
  48.       @actor_cp_sprite[actor.index].z = 102
  49.       @actor_cp_sprite_back[actor.index] = Sprite.new
  50.       @actor_cp_sprite_back[actor.index].bitmap = Bitmap.new("Graphics/system/battle/hmcp/cp_sprite")
  51.       @actor_cp_sprite_back[actor.index].x = 450
  52.       @actor_cp_sprite_back[actor.index].y = 25
  53.       @actor_cp_sprite_back[actor.index].z = 102
  54.     end
  55.     for actor_index in 1..$game_party.actors.size
  56.       @cp_output[actor_index] = Sprite.new
  57.       @cp_output[actor_index].bitmap = Bitmap.new(133, 78)
  58.       @cp_output[actor_index].x = 100 + (actor_index - 1) * 133
  59.       @cp_output[actor_index].y = 480 - 78 - 10
  60.       @cp_output[actor_index].z = self.z + 2
  61.       @cp_output[actor_index].bitmap.clear
  62.       @sta_back[actor_index] = Sprite.new
  63.       @sta_back[actor_index].bitmap = Bitmap.new("Graphics/System/Battle/sta_back/" + $game_party.actors[actor_index - 1].name + "_sta.png")
  64.       @sta_back[actor_index].x = 100 + (actor_index - 1) * 133
  65.       @sta_back[actor_index].y = 480 - 78 - 10
  66.       @sta_back[actor_index].z = self.z + 1
  67.       @sta_output[actor_index] = Sprite.new
  68.       @sta_output[actor_index].bitmap = Bitmap.new(133, 78)
  69.       @sta_output[actor_index].x = 100 + (actor_index - 1) * 133
  70.       @sta_output[actor_index].y = 480 - 78 - 10
  71.       @sta_output[actor_index].z = self.z + 2
  72.       @sta_output[actor_index].bitmap.clear
  73.       @sta_output[actor_index].bitmap.font.size = 10
  74.       @sta_output[actor_index].bitmap.font.name = "黑体"
  75.       hp_width = $game_party.actors[actor_index - 1].hp * @hp_bitmap.width/$game_party.actors[actor_index - 1].maxhp
  76.       hp_rect = Rect.new(0, 0, hp_width, 3)
  77.       mp_width = $game_party.actors[actor_index - 1].sp * @mp_bitmap.width/$game_party.actors[actor_index - 1].maxsp
  78.       mp_rect = Rect.new(0, 0, mp_width, 3)
  79.       @sta_output[actor_index].bitmap.blt(66, 44, @hp_bitmap, hp_rect)
  80.       @sta_output[actor_index].bitmap.blt(66, 64, @mp_bitmap, mp_rect)
  81.       @sta_output[actor_index].bitmap.font.color.set(255, 0, 0)
  82.       @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)
  83.       @sta_output[actor_index].bitmap.font.color.set(0, 0, 255)
  84.       @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)
  85.     end
  86.     #........................................................................
  87.     refresh
  88.   end
  89.   
  90.   #--------------------------------------------------------------------------
  91.   # ● 释放
  92.   #--------------------------------------------------------------------------
  93.   def dispose
  94.     super
  95.     @hp_bitmap.bitmap.dispose
  96.     @hp_bitmap.dispose
  97.     @mp_bitmap.bitmap.dispose
  98.     @mp_bitmap.dispose
  99.     @cp_bitmap.bitmap.dispose
  100.     @cp_bitmap.dispose
  101.     for actor_index in 1..$game_party.actors.size
  102.       @sta_back[actor_index].bitmap.dispose
  103.       @sta_back[actor_index].dispose
  104.       @sta_output[actor_index].bitmap.dispose
  105.       @sta_output[actor_index].dispose
  106.       @cp_output[actor_index].bitmap.dispose
  107.       @cp_output[actor_index].dispose
  108.     end
  109.   end
  110.   #--------------------------------------------------------------------------
  111.   # ● 设置升级标志
  112.   #     actor_index : 角色索引
  113.   #--------------------------------------------------------------------------
  114.   def level_up(actor_index)
  115.     @level_up_flags[actor_index] = true
  116.   end
  117.   #......................................................................
  118.   #--------------------------------------------------------------------------
  119.   # ● 设置正在攻击标志
  120.   #     actor_index : 角色索引
  121.   #--------------------------------------------------------------------------
  122.   def in_atk(actor_index)
  123.     @sta_back[actor_index + 1].bitmap = Bitmap.new("Graphics/System/Battle/sta_back/" + $game_party.actors[actor_index].name + "_sta.png")
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   # ● 设置不在攻击标志
  127.   #     actor_index : 角色索引
  128.   #--------------------------------------------------------------------------
  129.   def out_atk(actor_index)
  130.     @sta_back[actor_index + 1].bitmap = Bitmap.new("Graphics/System/Battle/sta_back/" + $game_party.actors[actor_index].name + "_sta.png")
  131.   end
  132.   #......................................................................
  133.   #--------------------------------------------------------------------------
  134.   # ● 刷新
  135.   #--------------------------------------------------------------------------
  136.   def refresh
  137.     self.contents.clear
  138.     @item_max = $game_party.actors.size
  139.     for i in 0...$game_party.actors.size
  140.       actor = $game_party.actors[i]
  141.       #......................................................................
  142.       actor_x = i * 133 + 100
  143.       @sta_output[i + 1].bitmap.clear
  144.       hp_width = $game_party.actors[i].hp * @hp_bitmap.width/$game_party.actors[i].maxhp
  145.       hp_rect = Rect.new(0, 0, hp_width, 3)
  146.       mp_width = $game_party.actors[i].sp * @mp_bitmap.width/$game_party.actors[i].maxsp
  147.       mp_rect = Rect.new(0, 0, mp_width, 3)
  148.       @sta_output[i + 1].bitmap.blt(66, 44, @hp_bitmap, hp_rect)
  149.       @sta_output[i + 1].bitmap.blt(66, 64, @mp_bitmap, mp_rect)
  150.       @sta_output[i + 1].bitmap.font.color.set(255, 0, 0)
  151.       @sta_output[i + 1].bitmap.draw_text(80, 31, 77, 11,$game_party.actors[i].hp.to_s + "/" + $game_party.actors[i].maxhp.to_s)
  152.       @sta_output[i + 1].bitmap.font.color.set(0, 0, 255)
  153.       @sta_output[i + 1].bitmap.draw_text(80, 51, 77, 11,$game_party.actors[i].sp.to_s + "/" + $game_party.actors[i].maxsp.to_s)
  154.       #......................................................................
  155.       if @level_up_flags[i]
  156.         self.contents.font.color = normal_color
  157.         self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
  158.       else
  159.         draw_actor_state(actor, actor_x, 96)
  160.       end
  161.     end
  162.   end
  163.   #--------------------------------------------------------------------------
  164.   # ● 刷新画面
  165.   #--------------------------------------------------------------------------
  166.   def update
  167.     super
  168.     # 主界面的不透明度下降
  169.     if $game_temp.battle_main_phase
  170.       self.contents_opacity -= 4 if self.contents_opacity > 1
  171.     else
  172.       self.contents_opacity += 4 if self.contents_opacity < 255
  173.     end
  174.   end
  175. end
复制代码

hp sp cp 条 全有了
合成物品 去主站搜  
2楼 给出了关键词

LS的我还以为你是凌冰马甲呢……{/gg}
我们不是浪费生命来的…… Let's +U!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2025-8-8 22:19

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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