查看: 2189|回复: 3

[已经过期] 横版战斗怎么让数据库的战斗图也插入

[复制链接]
梦石
0
星屑
50
在线时间
11 小时
注册时间
2016-10-29
回帖
0
发表于 2016-11-20 13:06:41 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
数据库的角色脸谱用来战斗,数据库的战斗图插入到状态
360截图.png
梦石
0
星屑
2457
在线时间
912 小时
注册时间
2014-10-14
回帖
1155

开拓者

发表于 2016-12-5 21:10:12 | 显示全部楼层
[pre lang="ruby"]# ————————————————————————————————————
# 本脚本来自www.66rpg.com,转载请保留此信息
# ————————————————————————————————————
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
#  处理角色的类。本类在 Game_Actors 类 ($game_actors)
# 的内部使用、Game_Party 类请参考 ($game_party) 。
#==============================================================================
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ● 取得战斗画面的 X 坐标
  #--------------------------------------------------------------------------
  def screen_x
case $game_party.actors.size  #判断当前出战的总人数
when 1                       #判断当前出战的总人数为1
case self.index
when 0                        #1号角色
   return 455               
else
   return 640
end
  #出战人数为2
when 2
case self.index
when 0 #1号角色
   return 435
when 1 #2号角色
   return 515
else
   return 640
end
  #出战人数为3
when 3
case self.index
when 0 #1号角色
   return 395
when 1 #2号角色
   return 505
when 2 #3号角色
   return 515
else
   return 640
  end
  #出战人数为4
when 4
case self.index
when 0 #1号角色
   return 435
when 1 #2号角色
   return 515
when 2 #3号角色
   return 335
when 3 #4号角色
   return 590
else
   return 640
  end
end
  #--------------------------------------------------------------------------
  # ● 取得战斗画面的 Y 坐标 大是下 小是上
  #--------------------------------------------------------------------------
def screen_y
case $game_party.actors.size  #判断当前出战的总人数
when 1                       #判断当前出战的总人数为1
case self.index
when 0                        #1号角色
   return 485               
else
   return 500
end
  #出战人数为2
when 2
case self.index
when 0 #1号角色
   return 215
when 1 #2号角色
   return 235
else
   return 1000
end
  #出战人数为3
when 3
case self.index
when 0 #1号角色
   return 215
when 1 #2号角色
   return 235
when 2 #3号角色
   return 495
else
   return 600
  end
  #出战人数为4
when 4
case self.index
when 0 #1号角色
   return 215
when 1 #2号角色
   return 235
when 2 #3号角色
   return 375
when 3 #4号角色
   return 240
else
   return 1000
  end
end
  #--------------------------------------------------------------------------
  # ● 取得战斗画面的 Z 坐标
  #--------------------------------------------------------------------------
  def screen_z
    case self.index
    when 0
      return 15#10
    when 1
      return 14
    when 2
      return 16
    when 3
      return 13
    else
      return 0
    end
  end
end
end
end
###################################################
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
#  游戏中全部窗口的超级类。
#==============================================================================
class Window_Base < Window
  #--------------------------------------------------------------------------
  # ● 描绘 HP
  #     actor : 角色
  #     x     : 描画目标 X 坐标
  #     y     : 描画目标 Y 坐标
  #     width : 描画目标的宽
  #--------------------------------------------------------------------------
  def draw_actor_hp1(actor, x, y, width = 72)
    # 描绘字符串 "HP"
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 24, 24, $data_system.words.hp)
    # 计算描绘 MaxHP 所需的空间
    if width - 24 >= 32
      hp_x = x + 32# + width - 24
    end
    # 描绘 HP
    self.contents.font.color = actor.hp == 0 ? knockout_color :
      actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
   # self.contents.font.color = Color.new(255, 225, 198, 255)

    self.contents.draw_text(hp_x, y, 32, 24, actor.hp.to_s, 2)
  end
  #--------------------------------------------------------------------------
  # ● 描绘 SP
  #     actor : 角色
  #     x     : 描画目标 X 坐标
  #     y     : 描画目标 Y 坐标
  #     width : 描画目标的宽
  #--------------------------------------------------------------------------
  def draw_actor_sp1(actor, x, y, width = 72)
    # 描绘字符串 "SP"
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 24, 24, $data_system.words.sp)
    # 计算描绘 MaxSP 所需的空间
    if width - 24 >= 32
      sp_x = x + 32# + width - 24
    end
    # 描绘 SP
    self.contents.font.color = actor.sp == 0 ? knockout_color :
      actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
   # self.contents.font.color = Color.new(255, 125, 198, 255)
    self.contents.draw_text(sp_x, y, 32, 24, actor.sp.to_s, 2)
  end
    ###########################################################################
  #--------------------------------------------------------------------------
  # ● 战斗时图形的描绘
  #     actor : 角色
  #     x     : 描画目标 X 坐标
  #     y     : 描画目标 Y 坐标
  #--------------------------------------------------------------------------
  def draw_battle_actor(actor, x, y)
    bitmap=Bitmap.new("Graphics/Picturess/#{actor.id}")
    cw = bitmap.width
    ch = bitmap.height
    src_rect = Rect.new(0, 0, cw, ch)
    self.contents.blt(x - cw/20, y - ch, bitmap, src_rect)
  end
  ###########################################################################
end



#==============================================================================
# ■ Window_BattleStatus
#------------------------------------------------------------------------------
#  显示战斗画面同伴状态的窗口。
#==============================================================================
class Window_BattleStatus < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #--------------------------------------------------------------------------
  #$data_system_level_up_me = "Audio/ME/升级音乐"
  def initialize
    super(0, 0, 640, 480)#(0, 0, 640, 480)
    self.contents = Bitmap.new(width - 10, height - 32)
    self.opacity = 0
    @level_up_flags = [false, false, false, false]
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 释放
  #--------------------------------------------------------------------------
  def dispose
    super
  end
  #--------------------------------------------------------------------------
  # ● 设置升级标志
  #     actor_index : 角色索引
  #--------------------------------------------------------------------------
  def level_up(actor_index)
    @level_up_flags[actor_index] = true
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      actor = $game_party.actors
      x = i * 150 + 140#160 + 140
      y = 370
      #########################################
      draw_battle_actor(actor,x-180,y+83) #整体图片的坐标
      #########################################

      if @level_up_flags
        self.contents.font.color = normal_color
        self.contents.draw_text(x+18,y+50, 80, 24, "等级 提升!")
        Audio.me_stop
      else
       draw_actor_hp1(actor, x-90, y+20, 80)   
       draw_actor_sp1(actor, x-75, y+35, 80)#战斗画面角色血量文字的位置
   #按照CP制度的位置进行调整 最后的180是显示所需要的长度
   draw_actor_state(actor, actor.screen_x-50, actor.screen_y-30, 180)
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 刷新画面
  #--------------------------------------------------------------------------
  def update
    super
    # 主界面的不透明度下降
    if $game_temp.battle_main_phase
      self.contents_opacity -= 50 if self.contents_opacity > 255
    else
      self.contents_opacity += 50 if self.contents_opacity < 255
    end
  end
end


#==============================================================================
# ■ Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化
  #--------------------------------------------------------------------------
  alias xrxs_bp2_refresh refresh
  def refresh
    xrxs_bp2_refresh
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      actor = $game_party.actors
      x = i * 150 + 140#队友之间血条的距离
      y = 370
     # draw_actor_hp_meter(actor, x, y, 100)#血条的长短
      #draw_actor_sp_meter(actor, x, y + 8, 100)
      draw_actor_hp_meter(actor, x-70, y + 28, 55)
      draw_actor_sp_meter(actor, x-85, y +40, 65)
   
    end
  end
end
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
  #--------------------------------------------------------------------------
  # ● HP描画
  #--------------------------------------------------------------------------
  def draw_actor_hp_meter(actor, x, y, width = 156, type = 0)
    if type == 1 and actor.hp == 0
      return
    end
    self.contents.font.color = system_color
   # self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 25))
    self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 25))
    w = width * actor.hp / actor.maxhp
    #######################################################################
    self.contents.fill_rect(x, y+28, w,2, Color.new(255, 96, 96, 255))
    self.contents.fill_rect(x, y+30, w,1, Color.new(255, 96, 96, 255))
    self.contents.fill_rect(x, y+29, w,1, Color.new(255, 0, 0, 255))
    self.contents.fill_rect(x, y+30, w,1, Color.new(128, 0, 0, 255))
    self.contents.fill_rect(x, y+31, w,1, Color.new(0, 0, 0, 255))
    ###########################################################################
    #self.contents.fill_rect(x-131, y+55, w,1, Color.new(255, 96, 96, 255))
   # self.contents.fill_rect(x-131, y+54, w,1, Color.new(255, 0, 0, 255))
    #self.contents.fill_rect(x-131, y+55, w,1, Color.new(128, 0, 0, 255))
   # self.contents.fill_rect(x-131, y+56, w,1, Color.new(0, 0, 0, 255))
  end
  #--------------------------------------------------------------------------
  # ● SP描画
  #--------------------------------------------------------------------------
  def draw_actor_sp_meter(actor, x, y, width = 156, type = 0)
    if type == 1 and actor.hp == 0
      return
    end
    self.contents.font.color = system_color
    self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 255))
    w = width * actor.sp / actor.maxsp
    self.contents.fill_rect(x, y+28, w,1, Color.new(128, 255, 255, 255))
    self.contents.fill_rect(x, y+29, w,1, Color.new(0, 255, 255, 255))
    self.contents.fill_rect(x, y+30, w,1, Color.new(0, 192, 192, 255))
    self.contents.fill_rect(x, y+31, w,1, Color.new(0, 128, 128, 255))
   
   # self.contents.fill_rect(x-131, y+70, w,1, Color.new(128, 255, 255, 255))
    #self.contents.fill_rect(x-131, y+69, w,1, Color.new(0, 255, 255, 255))
    #self.contents.fill_rect(x-131, y+70, w,1, Color.new(0, 192, 192, 255))
   # self.contents.fill_rect(x-131, y+71, w,1, Color.new(0, 128, 128, 255))
end
end
[/pre]

点评

放弃 那个横版  发表于 2016-12-5 21:10
------落尽红樱君不见,轻绘梨花泪沾衣。~~~
回复

使用道具 举报

梦石
0
星屑
9716
在线时间
2775 小时
注册时间
2008-9-5
回帖
3458

开拓者短篇八RM组冠军短篇九导演组亚军白银编剧

发表于 2016-12-5 21:51:12 | 显示全部楼层
如果只需要表示一下战斗图的话,
也许可以用那个横板战斗系统,然后在Window_BattleStatus里绘制一下各角色的战斗图就好了?
前提是这些在状态栏里的战斗图不会成为攻击对象,不会闪烁,不会掉数字不会显示状态动画等等。。。
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部