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

Project1

 找回密码
 注册会员
搜索
查看: 1422|回复: 4
打印 上一主题 下一主题

[已经过期] 45度战斗与状态叠加,图标化的问题

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
47 小时
注册时间
2013-7-14
帖子
46
跳转到指定楼层
1
发表于 2013-7-26 08:40:51 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我用了45度战斗后,状态的x,y坐标应该也会变化,该怎么修改呢?
这是45°的
RUBY 代码复制
  1. # ————————————————————————————————————
  2. # 本脚本来自[url]http://rpg.blue/web/[/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 self.index
  16. when 0
  17. return 370
  18. when 1
  19. return 450
  20. when 2
  21. return 530
  22. when 3
  23. return 580
  24. else
  25. return 600
  26. end
  27. end
  28. #--------------------------------------------------------------------------
  29. # ● 取得战斗画面的 Y 坐标
  30. #--------------------------------------------------------------------------
  31. def screen_y
  32. case self.index
  33. when 0
  34. return 475
  35. when 1
  36. return 395
  37. when 2
  38. return 360
  39. when 3
  40. return 325
  41. else
  42. return 1000
  43. end
  44. end
  45. #--------------------------------------------------------------------------
  46. # ● 取得战斗画面的 Z 坐标
  47. #--------------------------------------------------------------------------
  48. def screen_z
  49. case self.index
  50. when 0
  51. return 10
  52. when 1
  53. return 9
  54. when 2
  55. return 8
  56. when 3
  57. return 7
  58. else
  59. return 0
  60. end
  61. end
  62. end
  63.  
  64. #==============================================================================
  65. # ■ Window_Base
  66. #------------------------------------------------------------------------------
  67. #  游戏中全部窗口的超级类。
  68. #==============================================================================
  69. class Window_Base < Window
  70. #--------------------------------------------------------------------------
  71. # ● 描绘 HP
  72. # actor : 角色
  73. # x : 描画目标 X 坐标
  74. # y : 描画目标 Y 坐标
  75. # width : 描画目标的宽
  76. #--------------------------------------------------------------------------
  77. def draw_actor_hp1(actor, x, y, width = 72)
  78. # 描绘字符串 "HP"
  79. self.contents.font.color = system_color
  80. self.contents.draw_text(x, y, 24, 24, $data_system.words.hp)
  81. # 计算描绘 MaxHP 所需的空间
  82. if width - 24 >= 32
  83. hp_x = x + 32# + width - 24
  84. end
  85. # 描绘 HP
  86. self.contents.font.color = actor.hp == 0 ? knockout_color :
  87. actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  88. self.contents.draw_text(hp_x, y, 32, 24, actor.hp.to_s, 2)
  89. end
  90. end
  91.  
  92.  
  93. #==============================================================================
  94. # ■ Window_BattleStatus
  95. #------------------------------------------------------------------------------
  96. #  显示战斗画面同伴状态的窗口。
  97. #==============================================================================
  98. class Window_BattleStatus < Window_Base
  99. #--------------------------------------------------------------------------
  100. # ● 初始化对像
  101. #--------------------------------------------------------------------------
  102. #$data_system_level_up_me = "Audio/ME/升级音乐"
  103. def initialize
  104. super(0, 0, 640, 480)
  105. self.contents = Bitmap.new(width - 10, height - 32)
  106. self.opacity = 0
  107. @level_up_flags = [false, false, false, false]
  108. refresh
  109. end
  110. #--------------------------------------------------------------------------
  111. # ● 释放
  112. #--------------------------------------------------------------------------
  113. def dispose
  114. super
  115. end
  116. #--------------------------------------------------------------------------
  117. # ● 设置升级标志
  118. # actor_index : 角色索引
  119. #--------------------------------------------------------------------------
  120. def level_up(actor_index)
  121. @level_up_flags[actor_index] = true
  122. end
  123. #--------------------------------------------------------------------------
  124. # ● 刷新
  125. #--------------------------------------------------------------------------
  126. def refresh
  127. self.contents.clear
  128. @item_max = $game_party.actors.size
  129. for i in 0...$game_party.actors.size
  130. actor = $game_party.actors[i]
  131. case i
  132. when 0
  133. x = 310
  134. y = 390
  135. when 1
  136. x = 390
  137. y = 340
  138. when 2
  139. x = 480
  140. y = 300
  141. when 3
  142. x = 550
  143. y = 270
  144. end
  145. if @level_up_flags[i]
  146. self.contents.font.color = normal_color
  147. self.contents.draw_text(x, y, 80, 24, "LEVEL UP!")
  148. Audio.me_stop
  149. # Audio.me_play($data_system_level_up_me)
  150. else
  151. draw_actor_hp1(actor, x-15, y-15, 80)
  152. end
  153. end
  154. end
  155. #--------------------------------------------------------------------------
  156. # ● 刷新画面
  157. #--------------------------------------------------------------------------
  158. def update
  159. super
  160. # 主界面的不透明度下降
  161. if $game_temp.battle_main_phase
  162. self.contents_opacity -= 50 if self.contents_opacity > 1
  163. else
  164. self.contents_opacity += 50 if self.contents_opacity < 255
  165. end
  166. end
  167. end
  168.  
  169.  
  170. #==============================================================================
  171. # ■ Window_BattleStatus
  172. #==============================================================================
  173. class Window_BattleStatus < Window_Base
  174. #--------------------------------------------------------------------------
  175. # ● 初始化
  176. #--------------------------------------------------------------------------
  177. alias xrxs_bp2_refresh refresh
  178. def refresh
  179. xrxs_bp2_refresh
  180. @item_max = $game_party.actors.size
  181. for i in 0...$game_party.actors.size
  182. actor = $game_party.actors[i]
  183. case i
  184. when 0
  185. x = 310
  186. y = 390
  187. when 1
  188. x = 390
  189. y = 340
  190. when 2
  191. x = 480
  192. y = 300
  193. when 3
  194. x = 550
  195. y = 270
  196. end
  197. draw_actor_hp_meter(actor, x, y, 50)
  198. end
  199. end
  200. end
  201. #==============================================================================
  202. # ■ Window_Base
  203. #==============================================================================
  204. class Window_Base < Window
  205. #--------------------------------------------------------------------------
  206. # ● HP描画
  207. #--------------------------------------------------------------------------
  208. def draw_actor_hp_meter(actor, x, y, width = 156, type = 0)
  209. if type == 1 and actor.hp == 0
  210. return
  211. end
  212. self.contents.font.color = system_color
  213. self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(150, 0, 0, 150))
  214. w = width * actor.hp / actor.maxhp
  215. self.contents.fill_rect(x, y+28, w,1, Color.new(255, 96, 96, 255))
  216. self.contents.fill_rect(x, y+29, w,1, Color.new(255, 0, 0, 255))
  217. self.contents.fill_rect(x, y+30, w,1, Color.new(128, 0, 0, 255))
  218. self.contents.fill_rect(x, y+31, w,1, Color.new(0, 0, 0, 255))
  219. end
  220. end

这是图标的
RUBY 代码复制
  1. #==============================================================================
  2. # Date 12-31-2005
  3. # 重定义类:Window_Base, Window_Help
  4. #==============================================================================
  5. # 脚本功能:
  6. # 实现战斗中和菜单中用图标显示状态,代替原来的文字显示。
  7. # 默认最多同时显示5个状态
  8. #------------------------------------------------------------------------------
  9. # 设置方法:
  10. # 一个状态对应的图标文件名为“状态的动画ID.png”
  11. # 例如某状态的动画ID为50,那么它的图标就是“Icons\50.png”
  12. # 如果找不到对应的文件,会报错
  13. #==============================================================================
  14.  
  15. # 注意,在ICON_STATE_IDS中写上需要带图标的状态ID
  16. # ICON_STATE_IDS是一个数组,数组的方法请参考帮助文件
  17. # 例如:
  18. # 只要1,5,8号状态带图标,就这样:ICON_STATE_IDS = [1,5,8]
  19. # 要20到50号状态带图标:ICON_STATE_IDS = 20..50
  20.  
  21. ICON_STATE_IDS = [40..79]
  22.  
  23. #==============================================================================
  24. # ■ Window_Base
  25. #------------------------------------------------------------------------------
  26. #  游戏中全部窗口的超级类。
  27. #==============================================================================
  28.  
  29. class Window_Base < Window
  30. #--------------------------------------------------------------------------
  31. # ● 描绘状态
  32. #     actor : 角色
  33. #     x     : 描画目标 X 坐标
  34. #     y     : 描画目标 Y 坐标
  35. #     width : 描画目标的宽
  36. #--------------------------------------------------------------------------
  37. def draw_actor_state(actor, x, y, width = 120)
  38.   state_size = 0
  39.   for state in actor.states
  40.     # 图标数量超出宽度就中断循环
  41.     if state_size >= width / 24 - 1
  42.       break
  43.     end
  44.     # 此状态不带图标就跳过
  45.     if !ICON_STATE_IDS.include?(state)
  46.       next
  47.     end
  48.     bitmap = RPG::Cache.icon($data_states[state].name + ".png")
  49.     if actor.states_turn[state] >= $data_states[state].hold_turn/2
  50.       opacity = 255
  51.     else
  52.       opacity = 100
  53.     end
  54.     # 这里的图标大小默认是24x24,要改就改下面那个Rect.new(0, 0, 24, 24)
  55.     self.contents.blt(x + 24 * state_size ,y ,bitmap, Rect.new(0, 0, 24, 24), opacity)
  56.     state_size += 1
  57.   end
  58. end
  59. end
  60.  
  61.  
  62. #==============================================================================
  63. # ■ Window_Help
  64. #------------------------------------------------------------------------------
  65. #  特技及物品的说明、角色的状态显示的窗口。
  66. #==============================================================================
  67.  
  68. class Window_Help < Window_Base
  69. #--------------------------------------------------------------------------
  70. # ● 设置敌人
  71. #     enemy : 要显示名字和状态的敌人
  72. #--------------------------------------------------------------------------
  73. def set_enemy(enemy)
  74.   # 描绘状态图标
  75.   state_size = 0
  76.   for state in enemy.states
  77.     # 图标数量超出宽度就中断循环
  78.     if state_size >= width / 16
  79.       break
  80.     end
  81.     # 此状态不带图标就跳过
  82.     if !ICON_STATE_IDS.include?(state)
  83.       next
  84.     end
  85.     bitmap = RPG::Cache.icon($data_states[state].name + "_sta.png")
  86.     if enemy.states_turn[state] >= $data_states[state].hold_turn/2
  87.       opacity = 255
  88.     else
  89.       opacity = 100
  90.     end
  91.     self.contents.blt(70 + 16 * state_size, 0, bitmap, Rect.new(0, 0, 24, 24), opacity)
  92.     state_size += 1
  93.   end
  94.   # 描绘敌人名字
  95.   set_text(enemy.name, 1)
  96. end
  97. end
  98.  
  99. class Game_Battler
  100. attr_reader :states_turn       # 声明状态剩余回合
  101. end


Lv1.梦旅人

梦石
0
星屑
50
在线时间
47 小时
注册时间
2013-7-14
帖子
46
2
 楼主| 发表于 2013-7-26 08:43:02 | 只看该作者
再给个范例

Project1.zip

203.92 KB, 下载次数: 29

就这个

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
52
在线时间
586 小时
注册时间
2012-5-31
帖子
768
3
发表于 2013-7-26 11:55:34 | 只看该作者
表示没明白楼主 表达的意思、、、、
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
47 小时
注册时间
2013-7-14
帖子
46
4
 楼主| 发表于 2013-7-26 12:15:35 | 只看该作者
用了45度战斗后,状态图标不知道上哪里去了,应该是坐标的问题。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
54
在线时间
1208 小时
注册时间
2011-1-23
帖子
910

贵宾

5
发表于 2013-8-8 09:47:19 | 只看该作者
这个45度战斗是把原本的战斗状态栏去掉的,状态也就不能显示了
  1. # ————————————————————————————————————
  2. # 本脚本来自[url]http://rpg.blue/web/[/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 self.index
  16. when 0
  17. return 370
  18. when 1
  19. return 450
  20. when 2
  21. return 530
  22. when 3
  23. return 580
  24. else
  25. return 600
  26. end
  27. end
  28. #--------------------------------------------------------------------------
  29. # ● 取得战斗画面的 Y 坐标
  30. #--------------------------------------------------------------------------
  31. def screen_y
  32. case self.index
  33. when 0
  34. return 475
  35. when 1
  36. return 395
  37. when 2
  38. return 360
  39. when 3
  40. return 325
  41. else
  42. return 1000
  43. end
  44. end
  45. #--------------------------------------------------------------------------
  46. # ● 取得战斗画面的 Z 坐标
  47. #--------------------------------------------------------------------------
  48. def screen_z
  49. case self.index
  50. when 0
  51. return 10
  52. when 1
  53. return 9
  54. when 2
  55. return 8
  56. when 3
  57. return 7
  58. else
  59. return 0
  60. end
  61. end
  62. end
复制代码
45度脚本仅保留这段的话战斗画面下面会出现默认的状态栏,就可以显示状态,要不要用楼主先看着办,先不给你结贴

评分

参与人数 1星屑 +70 收起 理由
弗雷德 + 70 我很赞同

查看全部评分

→→→牛排的小黑屋←←←
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-6-30 07:03

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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