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

Project1

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

[已经解决] 这个45度战斗系统的脚本如何完善

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
75
在线时间
17 小时
注册时间
2009-1-14
帖子
12
跳转到指定楼层
1
发表于 2009-10-3 13:21:11 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我要做的游戏有战斗场景 所以找了个45度角的战斗系统  但是 用了之后还是有战斗和逃跑还有下面那一排的状态图像 有高手能帮忙看下嘛?

Lv1.梦旅人

℃ake

梦石
0
星屑
50
在线时间
8 小时
注册时间
2009-6-6
帖子
787
2
发表于 2009-10-3 13:45:40 | 只看该作者
  1. # ————————————————————————————————————
  2. # 本脚本来自www.66rpg.com,转载请保留此信息
  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 350
  18. when 1
  19.    return 430
  20. when 2
  21.    return 510
  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 430
  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.    
  237.    end
  238. #--------------------------------------------------------------------------
  239. # ● SP描画
  240. #--------------------------------------------------------------------------
  241. def draw_actor_sp_meter(actor, x, y, width = 156, type = 0)
  242.    if type == 1 and actor.hp == 0
  243.      return
  244.    end
  245.    self.contents.font.color = system_color
  246.    self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 255))
  247.    w = width * actor.sp / actor.maxsp
  248.    self.contents.fill_rect(x, y+28, w,1, Color.new(128, 255, 255, 255))
  249.    self.contents.fill_rect(x, y+29, w,1, Color.new(0, 255, 255, 255))
  250.    self.contents.fill_rect(x, y+30, w,1, Color.new(0, 192, 192, 255))
  251.    self.contents.fill_rect(x, y+31, w,1, Color.new(0, 128, 128, 255))
  252. end
  253. end
复制代码
我爱66RPG,但我讨厌66.
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2009-10-3
帖子
25
3
发表于 2009-10-3 13:57:54 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

~琉璃の雪~<

梦石
0
星屑
49
在线时间
36 小时
注册时间
2008-11-6
帖子
3678
4
发表于 2009-10-3 14:11:42 | 只看该作者
柳柳有个专门45度战斗的教学
http://rpg.blue/web/index.php?doc-view-3601
如果连接失效了,LZ可以去FTP里找找,这个东西我也帮别人上传过.
另外要直接改45度的话,下面这个也行:
http://rpg.blue/web/index.php?doc-view-4073
要注意的是如果LZ向改变战斗者的坐标,就要连血条坐标一起调整,否则会很orz.
~现在开始自绘头像~
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-29 20:39

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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