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

Project1

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

[已经解决] 有关45度战斗问题

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
39 小时
注册时间
2011-8-6
帖子
10
跳转到指定楼层
1
发表于 2011-10-3 09:34:56 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
  1. # ————————————————————————————————————
  2. # 本脚本来自http://rpg.blue/web/,转载请保留此信息
  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. # ■ Window_Base
  65. #------------------------------------------------------------------------------
  66. #  游戏中全部窗口的超级类。
  67. #==============================================================================
  68. class Window_Base < Window
  69. #--------------------------------------------------------------------------
  70. # ● 描绘 HP
  71. # actor : 角色
  72. # x : 描画目标 X 坐标
  73. # y : 描画目标 Y 坐标
  74. # width : 描画目标的宽
  75. #--------------------------------------------------------------------------
  76. def draw_actor_hp1(actor, x, y, width = 72)
  77. # 描绘字符串 "HP"
  78. self.contents.font.color = system_color
  79. self.contents.draw_text(x, y, 24, 24, $data_system.words.hp)
  80. # 计算描绘 MaxHP 所需的空间
  81. if width - 24 >= 32
  82. hp_x = x + 32# + width - 24
  83. end
  84. # 描绘 HP
  85. self.contents.font.color = actor.hp == 0 ? knockout_color :
  86. actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  87. self.contents.draw_text(hp_x, y, 32, 24, actor.hp.to_s, 2)
  88. end
  89. #--------------------------------------------------------------------------
  90. # ● 描绘 SP
  91. # actor : 角色
  92. # x : 描画目标 X 坐标
  93. # y : 描画目标 Y 坐标
  94. # width : 描画目标的宽
  95. #--------------------------------------------------------------------------
  96. def draw_actor_sp1(actor, x, y, width = 72)
  97. # 描绘字符串 "SP"
  98. self.contents.font.color = system_color
  99. self.contents.draw_text(x, y, 24, 24, $data_system.words.sp)
  100. # 计算描绘 MaxSP 所需的空间
  101. if width - 24 >= 32
  102. sp_x = x + 32# + width - 24
  103. end
  104. # 描绘 SP
  105. self.contents.font.color = actor.sp == 0 ? knockout_color :
  106. actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  107. self.contents.draw_text(sp_x, y, 32, 24, actor.sp.to_s, 2)
  108. end
  109. end


  110. #==============================================================================
  111. # ■ Window_BattleStatus
  112. #------------------------------------------------------------------------------
  113. #  显示战斗画面同伴状态的窗口。
  114. #==============================================================================
  115. class Window_BattleStatus < Window_Base
  116. #--------------------------------------------------------------------------
  117. # ● 初始化对像
  118. #--------------------------------------------------------------------------
  119. #$data_system_level_up_me = "Audio/ME/升级音乐"
  120. def initialize
  121. super(0, 0, 640, 480)
  122. self.contents = Bitmap.new(width - 10, height - 32)
  123. self.opacity = 0
  124. @level_up_flags = [false, false, false, false]
  125. refresh
  126. end
  127. #--------------------------------------------------------------------------
  128. # ● 释放
  129. #--------------------------------------------------------------------------
  130. def dispose
  131. super
  132. end
  133. #--------------------------------------------------------------------------
  134. # ● 设置升级标志
  135. # actor_index : 角色索引
  136. #--------------------------------------------------------------------------
  137. def level_up(actor_index)
  138. @level_up_flags[actor_index] = true
  139. end
  140. #--------------------------------------------------------------------------
  141. # ● 刷新
  142. #--------------------------------------------------------------------------
  143. def refresh
  144. self.contents.clear
  145. @item_max = $game_party.actors.size
  146. for i in 0...$game_party.actors.size
  147. actor = $game_party.actors[i]
  148. case i
  149. when 0
  150. x = 310
  151. y = 390
  152. when 1
  153. x = 390
  154. y = 340
  155. when 2
  156. x = 480
  157. y = 300
  158. when 3
  159. x = 550
  160. y = 270
  161. end
  162. if @level_up_flags[i]
  163. self.contents.font.color = normal_color
  164. self.contents.draw_text(x, y, 80, 24, "LEVEL UP!")
  165. Audio.me_stop
  166. # Audio.me_play($data_system_level_up_me)
  167. else
  168. draw_actor_hp1(actor, x-15, y-15, 80)
  169. draw_actor_sp1(actor, x-15, y+5, 80)
  170. end
  171. end
  172. end
  173. #--------------------------------------------------------------------------
  174. # ● 刷新画面
  175. #--------------------------------------------------------------------------
  176. def update
  177. super
  178. # 主界面的不透明度下降
  179. if $game_temp.battle_main_phase
  180. self.contents_opacity -= 50 if self.contents_opacity > 1
  181. else
  182. self.contents_opacity += 50 if self.contents_opacity < 255
  183. end
  184. end
  185. end


  186. #==============================================================================
  187. # ■ Window_BattleStatus
  188. #==============================================================================
  189. class Window_BattleStatus < Window_Base
  190. #--------------------------------------------------------------------------
  191. # ● 初始化
  192. #--------------------------------------------------------------------------
  193. alias xrxs_bp2_refresh refresh
  194. def refresh
  195. xrxs_bp2_refresh
  196. @item_max = $game_party.actors.size
  197. for i in 0...$game_party.actors.size
  198. actor = $game_party.actors[i]
  199. case i
  200. when 0
  201. x = 310
  202. y = 390
  203. when 1
  204. x = 390
  205. y = 340
  206. when 2
  207. x = 480
  208. y = 300
  209. when 3
  210. x = 550
  211. y = 270
  212. end
  213. draw_actor_hp_meter(actor, x, y, 50)
  214. draw_actor_sp_meter(actor, x, y + 8, 50)
  215. end
  216. end
  217. end
  218. #==============================================================================
  219. # ■ Window_Base
  220. #==============================================================================
  221. class Window_Base < Window
  222. #--------------------------------------------------------------------------
  223. # ● HP描画
  224. #--------------------------------------------------------------------------
  225. def draw_actor_hp_meter(actor, x, y, width = 156, type = 0)
  226. if type == 1 and actor.hp == 0
  227. return
  228. end
  229. self.contents.font.color = system_color
  230. self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 25))
  231. w = width * actor.hp / actor.maxhp
  232. self.contents.fill_rect(x, y+28, w,1, Color.new(255, 96, 96, 255))
  233. self.contents.fill_rect(x, y+29, w,1, Color.new(255, 0, 0, 255))
  234. self.contents.fill_rect(x, y+30, w,1, Color.new(128, 0, 0, 255))
  235. self.contents.fill_rect(x, y+31, w,1, Color.new(0, 0, 0, 255))
  236. end
  237. #--------------------------------------------------------------------------
  238. # ● SP描画
  239. #--------------------------------------------------------------------------
  240. def draw_actor_sp_meter(actor, x, y, width = 156, type = 0)
  241. if type == 1 and actor.hp == 0
  242. return
  243. end
  244. self.contents.font.color = system_color
  245. self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 255))
  246. w = width * actor.sp / actor.maxsp
  247. self.contents.fill_rect(x, y+28, w,1, Color.new(128, 255, 255, 255))
  248. self.contents.fill_rect(x, y+29, w,1, Color.new(0, 255, 255, 255))
  249. self.contents.fill_rect(x, y+30, w,1, Color.new(0, 192, 192, 255))
  250. self.contents.fill_rect(x, y+31, w,1, Color.new(0, 128, 128, 255))
  251. end
  252. end
复制代码
用这脚本的时候,下方出现一个黑条,而我用的是640*480的战斗图,请教一下,该怎样处理?谢谢!


136667于2011-10-3 09:50补充以下内容:
请高人指点一下吧,谢谢了!

Lv1.梦旅人

梦石
0
星屑
49
在线时间
486 小时
注册时间
2009-7-23
帖子
449
2
发表于 2011-10-3 10:31:51 | 只看该作者
修改脚本Spriteset_Battle
  1. @viewport1 = Viewport.new(0, 0, 640, 320)
复制代码
改为
  1. @viewport1 = Viewport.new(0, 0, 640, 480)
复制代码
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-23 20:38

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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