查看: 2253|回复: 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 | 显示全部楼层
  1. # ————————————————————————————————————
  2. # 本脚本来自[url]www.66rpg.com[/url],转载请保留此信息
  3. # ————————————————————————————————————
  4. #==============================================================================
  5. # ■ Game_Actor
  6. #------------------------------------------------------------------------------
  7. #  处理角色的类。本类在 Game_Actors 类 ($game_actors)
  8. # 的内部使用、Game_Party 类请参考 ($game_party) 。
  9. #==============================================================================
  10. class Game_Actor < Game_Battler
  11.   #--------------------------------------------------------------------------
  12.   # ● 取得战斗画面的 X 坐标
  13.   #--------------------------------------------------------------------------
  14.   def screen_x
  15. case $game_party.actors.size  #判断当前出战的总人数
  16. when 1                       #判断当前出战的总人数为1
  17. case self.index
  18. when 0                        #1号角色
  19.    return 455               
  20. else
  21.    return 640
  22. end
  23.   #出战人数为2
  24. when 2
  25. case self.index
  26. when 0 #1号角色
  27.    return 435
  28. when 1 #2号角色
  29.    return 515
  30. else
  31.    return 640
  32. end
  33.   #出战人数为3
  34. when 3
  35. case self.index
  36. when 0 #1号角色
  37.    return 395
  38. when 1 #2号角色
  39.    return 505
  40. when 2 #3号角色
  41.    return 515
  42. else
  43.    return 640
  44.   end
  45.   #出战人数为4
  46. when 4
  47. case self.index
  48. when 0 #1号角色
  49.    return 435
  50. when 1 #2号角色
  51.    return 515
  52. when 2 #3号角色
  53.    return 335
  54. when 3 #4号角色
  55.    return 590
  56. else
  57.    return 640
  58.   end
  59. end
  60.   #--------------------------------------------------------------------------
  61.   # ● 取得战斗画面的 Y 坐标 大是下 小是上
  62.   #--------------------------------------------------------------------------
  63. def screen_y
  64. case $game_party.actors.size  #判断当前出战的总人数
  65. when 1                       #判断当前出战的总人数为1
  66. case self.index
  67. when 0                        #1号角色
  68.    return 485               
  69. else
  70.    return 500
  71. end
  72.   #出战人数为2
  73. when 2
  74. case self.index
  75. when 0 #1号角色
  76.    return 215
  77. when 1 #2号角色
  78.    return 235
  79. else
  80.    return 1000
  81. end
  82.   #出战人数为3
  83. when 3
  84. case self.index
  85. when 0 #1号角色
  86.    return 215
  87. when 1 #2号角色
  88.    return 235
  89. when 2 #3号角色
  90.    return 495
  91. else
  92.    return 600
  93.   end
  94.   #出战人数为4
  95. when 4
  96. case self.index
  97. when 0 #1号角色
  98.    return 215
  99. when 1 #2号角色
  100.    return 235
  101. when 2 #3号角色
  102.    return 375
  103. when 3 #4号角色
  104.    return 240
  105. else
  106.    return 1000
  107.   end
  108. end
  109.   #--------------------------------------------------------------------------
  110.   # ● 取得战斗画面的 Z 坐标
  111.   #--------------------------------------------------------------------------
  112.   def screen_z
  113.     case self.index
  114.     when 0
  115.       return 15#10
  116.     when 1
  117.       return 14
  118.     when 2
  119.       return 16
  120.     when 3
  121.       return 13
  122.     else
  123.       return 0
  124.     end
  125.   end
  126. end
  127. end
  128. end
  129. ###################################################
  130. #==============================================================================
  131. # ■ Window_Base
  132. #------------------------------------------------------------------------------
  133. #  游戏中全部窗口的超级类。
  134. #==============================================================================
  135. class Window_Base < Window
  136.   #--------------------------------------------------------------------------
  137.   # ● 描绘 HP
  138.   #     actor : 角色
  139.   #     x     : 描画目标 X 坐标
  140.   #     y     : 描画目标 Y 坐标
  141.   #     width : 描画目标的宽
  142.   #--------------------------------------------------------------------------
  143.   def draw_actor_hp1(actor, x, y, width = 72)
  144.     # 描绘字符串 "HP"
  145.     self.contents.font.color = system_color
  146.     self.contents.draw_text(x, y, 24, 24, $data_system.words.hp)
  147.     # 计算描绘 MaxHP 所需的空间
  148.     if width - 24 >= 32
  149.       hp_x = x + 32# + width - 24
  150.     end
  151.     # 描绘 HP
  152.     self.contents.font.color = actor.hp == 0 ? knockout_color :
  153.       actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  154.    # self.contents.font.color = Color.new(255, 225, 198, 255)

  155.     self.contents.draw_text(hp_x, y, 32, 24, actor.hp.to_s, 2)
  156.   end
  157.   #--------------------------------------------------------------------------
  158.   # ● 描绘 SP
  159.   #     actor : 角色
  160.   #     x     : 描画目标 X 坐标
  161.   #     y     : 描画目标 Y 坐标
  162.   #     width : 描画目标的宽
  163.   #--------------------------------------------------------------------------
  164.   def draw_actor_sp1(actor, x, y, width = 72)
  165.     # 描绘字符串 "SP"
  166.     self.contents.font.color = system_color
  167.     self.contents.draw_text(x, y, 24, 24, $data_system.words.sp)
  168.     # 计算描绘 MaxSP 所需的空间
  169.     if width - 24 >= 32
  170.       sp_x = x + 32# + width - 24
  171.     end
  172.     # 描绘 SP
  173.     self.contents.font.color = actor.sp == 0 ? knockout_color :
  174.       actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  175.    # self.contents.font.color = Color.new(255, 125, 198, 255)
  176.     self.contents.draw_text(sp_x, y, 32, 24, actor.sp.to_s, 2)
  177.   end
  178.     ###########################################################################
  179.   #--------------------------------------------------------------------------
  180.   # ● 战斗时图形的描绘
  181.   #     actor : 角色
  182.   #     x     : 描画目标 X 坐标
  183.   #     y     : 描画目标 Y 坐标
  184.   #--------------------------------------------------------------------------
  185.   def draw_battle_actor(actor, x, y)
  186.     bitmap=Bitmap.new("Graphics/Picturess/#{actor.id}")
  187.     cw = bitmap.width
  188.     ch = bitmap.height
  189.     src_rect = Rect.new(0, 0, cw, ch)
  190.     self.contents.blt(x - cw/20, y - ch, bitmap, src_rect)
  191.   end
  192.   ###########################################################################
  193. end



  194. #==============================================================================
  195. # ■ Window_BattleStatus
  196. #------------------------------------------------------------------------------
  197. #  显示战斗画面同伴状态的窗口。
  198. #==============================================================================
  199. class Window_BattleStatus < Window_Base
  200.   #--------------------------------------------------------------------------
  201.   # ● 初始化对像
  202.   #--------------------------------------------------------------------------
  203.   #$data_system_level_up_me = "Audio/ME/升级音乐"
  204.   def initialize
  205.     super(0, 0, 640, 480)#(0, 0, 640, 480)
  206.     self.contents = Bitmap.new(width - 10, height - 32)
  207.     self.opacity = 0
  208.     @level_up_flags = [false, false, false, false]
  209.     refresh
  210.   end
  211.   #--------------------------------------------------------------------------
  212.   # ● 释放
  213.   #--------------------------------------------------------------------------
  214.   def dispose
  215.     super
  216.   end
  217.   #--------------------------------------------------------------------------
  218.   # ● 设置升级标志
  219.   #     actor_index : 角色索引
  220.   #--------------------------------------------------------------------------
  221.   def level_up(actor_index)
  222.     @level_up_flags[actor_index] = true
  223.   end
  224.   #--------------------------------------------------------------------------
  225.   # ● 刷新
  226.   #--------------------------------------------------------------------------
  227.   def refresh
  228.     self.contents.clear
  229.     @item_max = $game_party.actors.size
  230.     for i in 0...$game_party.actors.size
  231.       actor = $game_party.actors[i]
  232.       x = i * 150 + 140#160 + 140
  233.       y = 370
  234.       #########################################
  235.       draw_battle_actor(actor,x-180,y+83) #整体图片的坐标
  236.       #########################################

  237.       if @level_up_flags[i]
  238.         self.contents.font.color = normal_color
  239.         self.contents.draw_text(x+18,y+50, 80, 24, "等级 提升!")
  240.         Audio.me_stop
  241.       else
  242.        draw_actor_hp1(actor, x-90, y+20, 80)   
  243.        draw_actor_sp1(actor, x-75, y+35, 80)#战斗画面角色血量文字的位置
  244.    #按照CP制度的位置进行调整 最后的180是显示所需要的长度
  245.    draw_actor_state(actor, actor.screen_x-50, actor.screen_y-30, 180)
  246.       end
  247.     end
  248.   end
  249.   #--------------------------------------------------------------------------
  250.   # ● 刷新画面
  251.   #--------------------------------------------------------------------------
  252.   def update
  253.     super
  254.     # 主界面的不透明度下降
  255.     if $game_temp.battle_main_phase
  256.       self.contents_opacity -= 50 if self.contents_opacity > 255
  257.     else
  258.       self.contents_opacity += 50 if self.contents_opacity < 255
  259.     end
  260.   end
  261. end


  262. #==============================================================================
  263. # ■ Window_BattleStatus
  264. #==============================================================================
  265. class Window_BattleStatus < Window_Base
  266.   #--------------------------------------------------------------------------
  267.   # ● 初始化
  268.   #--------------------------------------------------------------------------
  269.   alias xrxs_bp2_refresh refresh
  270.   def refresh
  271.     xrxs_bp2_refresh
  272.     @item_max = $game_party.actors.size
  273.     for i in 0...$game_party.actors.size
  274.       actor = $game_party.actors[i]
  275.       x = i * 150 + 140#队友之间血条的距离
  276.       y = 370
  277.      # draw_actor_hp_meter(actor, x, y, 100)#血条的长短
  278.       #draw_actor_sp_meter(actor, x, y + 8, 100)
  279.       draw_actor_hp_meter(actor, x-70, y + 28, 55)
  280.       draw_actor_sp_meter(actor, x-85, y +40, 65)
  281.    
  282.     end
  283.   end
  284. end
  285. #==============================================================================
  286. # ■ Window_Base
  287. #==============================================================================
  288. class Window_Base < Window
  289.   #--------------------------------------------------------------------------
  290.   # ● HP描画
  291.   #--------------------------------------------------------------------------
  292.   def draw_actor_hp_meter(actor, x, y, width = 156, type = 0)
  293.     if type == 1 and actor.hp == 0
  294.       return
  295.     end
  296.     self.contents.font.color = system_color
  297.    # self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 25))
  298.     self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 25))
  299.     w = width * actor.hp / actor.maxhp
  300.     #######################################################################
  301.     self.contents.fill_rect(x, y+28, w,2, Color.new(255, 96, 96, 255))
  302.     self.contents.fill_rect(x, y+30, w,1, Color.new(255, 96, 96, 255))
  303.     self.contents.fill_rect(x, y+29, w,1, Color.new(255, 0, 0, 255))
  304.     self.contents.fill_rect(x, y+30, w,1, Color.new(128, 0, 0, 255))
  305.     self.contents.fill_rect(x, y+31, w,1, Color.new(0, 0, 0, 255))
  306.     ###########################################################################
  307.     #self.contents.fill_rect(x-131, y+55, w,1, Color.new(255, 96, 96, 255))
  308.    # self.contents.fill_rect(x-131, y+54, w,1, Color.new(255, 0, 0, 255))
  309.     #self.contents.fill_rect(x-131, y+55, w,1, Color.new(128, 0, 0, 255))
  310.    # self.contents.fill_rect(x-131, y+56, w,1, Color.new(0, 0, 0, 255))
  311.   end
  312.   #--------------------------------------------------------------------------
  313.   # ● SP描画
  314.   #--------------------------------------------------------------------------
  315.   def draw_actor_sp_meter(actor, x, y, width = 156, type = 0)
  316.     if type == 1 and actor.hp == 0
  317.       return
  318.     end
  319.     self.contents.font.color = system_color
  320.     self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 255))
  321.     w = width * actor.sp / actor.maxsp
  322.     self.contents.fill_rect(x, y+28, w,1, Color.new(128, 255, 255, 255))
  323.     self.contents.fill_rect(x, y+29, w,1, Color.new(0, 255, 255, 255))
  324.     self.contents.fill_rect(x, y+30, w,1, Color.new(0, 192, 192, 255))
  325.     self.contents.fill_rect(x, y+31, w,1, Color.new(0, 128, 128, 255))
  326.    
  327.    # self.contents.fill_rect(x-131, y+70, w,1, Color.new(128, 255, 255, 255))
  328.     #self.contents.fill_rect(x-131, y+69, w,1, Color.new(0, 255, 255, 255))
  329.     #self.contents.fill_rect(x-131, y+70, w,1, Color.new(0, 192, 192, 255))
  330.    # self.contents.fill_rect(x-131, y+71, w,1, Color.new(0, 128, 128, 255))
  331. end
  332. end
复制代码

点评

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

使用道具 举报

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

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

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

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部