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

Project1

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

[已经解决] 怎样把敌人的血行改下来一点

[复制链接]

Lv1.梦旅人

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

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

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

x
光移动敌人的队伍没有用

QQ图片20150517130451.jpg (80.94 KB, 下载次数: 7)

QQ图片20150517130451.jpg

QQ图片20150517130732.jpg (81.73 KB, 下载次数: 4)

QQ图片20150517130732.jpg

QQ图片20150517131223.jpg (94.28 KB, 下载次数: 6)

QQ图片20150517131223.jpg

Lv1.梦旅人

梦石
0
星屑
50
在线时间
226 小时
注册时间
2015-5-8
帖子
329
2
发表于 2015-5-17 13:21:04 | 只看该作者
請修改腳本中描繪血槽坐標的語句以達成想要的效果
我是妖精蕾貝卡,沉默少言,孤獨自卑。完成了一個小遊戲,歡迎試玩。同時也歡迎試玩師傅的遊戲,謝謝。
現正在努力學習事件中,有不明白的地方請各位指教。

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
126 小时
注册时间
2015-5-12
帖子
50
3
 楼主| 发表于 2015-5-17 13:37:22 | 只看该作者
本帖最后由 RyanBern 于 2015-5-17 14:58 编辑

在哪一行,帮我指一下谢谢
RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================
  4. # ■ エネミーHP&SP(ver 0.98)
  5.  
  6. # □ カスタマイズポイント
  7. #==============================================================================
  8. module PLAN_HPSP_DRAW
  9. FONT_NAME         = ["黑体", "楷体", "宋体"]    # フォント
  10. FONT_SIZE         =  14                               # フォントサイズ
  11. FONT_BOLD         = true                              # 太字
  12. FONT_ITALIC       = true                              # 斜体
  13.  
  14. DRAW_NAME         = false                             # 名前の描画
  15. DRAW_HP           = true                              # HP の描画
  16. DRAW_SP           = true                              # SP の描画
  17.  
  18. DRAW_WIDTH        =  80                               # 描画幅
  19. DRAW_HEIGHT       = 3 * 32                            # 描画高さ
  20. DRAW_SPACE        =   0                               # 行間
  21. DRAW_Y            =  36                               # Y 座標修正値
  22. end
  23.  
  24.  
  25. #==============================================================================
  26. # ■ Sprite_Battler
  27. #==============================================================================
  28.  
  29. class Sprite_Battler < RPG::Sprite
  30. #--------------------------------------------------------------------------
  31. # ● オブジェクト初期化
  32. #--------------------------------------------------------------------------
  33. alias plan_enemy_hpsp_draw_initialize initialize
  34. def initialize(viewport, battler = nil)
  35.   # 元のメソッドに戻す
  36.   plan_enemy_hpsp_draw_initialize(viewport, battler)
  37.   # エネミーの場合
  38.   if @battler.is_a?(Game_Enemy)
  39.     width = PLAN_HPSP_DRAW::DRAW_WIDTH + 32
  40.     height = PLAN_HPSP_DRAW::DRAW_HEIGHT + 32
  41.     x = @battler.screen_x - width / 2
  42.     y = @battler.screen_y - height + 32 + PLAN_HPSP_DRAW::DRAW_Y
  43.     @enemy_hpsp_window = Window_Base.new(x, y, width, height)
  44.     @enemy_hpsp_window.contents = Bitmap.new(width - 32, height - 32)
  45.     @enemy_hpsp_window.contents.font.name = PLAN_HPSP_DRAW::FONT_NAME
  46.     @enemy_hpsp_window.contents.font.size = PLAN_HPSP_DRAW::FONT_SIZE
  47.     @enemy_hpsp_window.contents.font.bold = PLAN_HPSP_DRAW::FONT_BOLD
  48.     @enemy_hpsp_window.contents.font.italic = PLAN_HPSP_DRAW::FONT_ITALIC
  49.     y = 0
  50.     @old_enemy_hpsp = []
  51.     one_line = ((PLAN_HPSP_DRAW::FONT_SIZE * 100 / 28) * 32) / 100
  52.     if PLAN_HPSP_DRAW::DRAW_NAME
  53.       @enemy_hpsp_window.draw_actor_name(@battler, 0, y, width - 32)
  54.       y += one_line + PLAN_HPSP_DRAW::DRAW_SPACE
  55.       @old_enemy_hpsp.push(@battler.name)
  56.     end
  57.     if PLAN_HPSP_DRAW::DRAW_HP
  58.       @enemy_hpsp_window.draw_actor_hp2222(@battler, 0, y, width - 32)
  59.       y += one_line + PLAN_HPSP_DRAW::DRAW_SPACE
  60.       @old_enemy_hpsp.push(@battler.hp)
  61.     end
  62.     if PLAN_HPSP_DRAW::DRAW_SP
  63.       @enemy_hpsp_window.draw_actor_sp2222(@battler, 0, y, width - 32)
  64.       @old_enemy_hpsp.push(@battler.sp)
  65.     end
  66.     @enemy_hpsp_window.opacity = 0
  67.     @enemy_hpsp_window.contents_opacity = 0
  68.     @enemy_hpsp_window.z = -2
  69.   end
  70. end
  71. #--------------------------------------------------------------------------
  72. # ● 解放
  73. #--------------------------------------------------------------------------
  74. alias plan_enemy_hpsp_draw_dispose dispose
  75. def dispose
  76.   # エネミーの場合
  77.   if @battler.is_a?(Game_Enemy)
  78.     @enemy_hpsp_window.dispose
  79.   end
  80.   # 元のメソッドに戻す
  81.   plan_enemy_hpsp_draw_dispose
  82. end
  83. #--------------------------------------------------------------------------
  84. # ● フレーム更新
  85. #--------------------------------------------------------------------------
  86. alias plan_enemy_hpsp_draw_update update
  87. def update
  88.   # 元のメソッドに戻す
  89.   plan_enemy_hpsp_draw_update
  90.   # エネミーの場合
  91.   if @battler.is_a?(Game_Enemy)
  92.     @enemy_hpsp_window.visible = @battler_visible
  93.   # スプライトの座標を設定
  94.     width = PLAN_HPSP_DRAW::DRAW_WIDTH + 32
  95.     @enemy_hpsp_window.x = self.x - width / 2
  96.     @now_enemy_hpsp = []
  97.     if PLAN_HPSP_DRAW::DRAW_NAME
  98.       @now_enemy_hpsp.push(@battler.name)
  99.     end
  100.     if PLAN_HPSP_DRAW::DRAW_HP
  101.       @now_enemy_hpsp.push(@battler.hp)
  102.     end
  103.     if PLAN_HPSP_DRAW::DRAW_SP
  104.       @now_enemy_hpsp.push(@battler.sp)
  105.     end
  106.     if @old_enemy_hpsp != @now_enemy_hpsp and $game_temp.enemy_hpsp_refresh
  107.       @old_enemy_hpsp = @now_enemy_hpsp
  108.       @enemy_hpsp_window.contents.clear
  109.       y = 0
  110.       width = PLAN_HPSP_DRAW::DRAW_WIDTH + 32
  111.       one_line = ((PLAN_HPSP_DRAW::FONT_SIZE * 100 / 28) * 32) / 100
  112.       if PLAN_HPSP_DRAW::DRAW_NAME
  113.         @enemy_hpsp_window.draw_actor_name(@battler, 0, y, width - 32)
  114.         y += one_line + PLAN_HPSP_DRAW::DRAW_SPACE
  115.       end
  116.       if PLAN_HPSP_DRAW::DRAW_HP
  117.         @enemy_hpsp_window.draw_actor_hp2222(@battler, 0, y, width - 32)
  118.         y += one_line + PLAN_HPSP_DRAW::DRAW_SPACE
  119.       end
  120.       if PLAN_HPSP_DRAW::DRAW_SP
  121.         @enemy_hpsp_window.draw_actor_sp2222(@battler, 0, y, width - 32)
  122.       end
  123.       Graphics.frame_reset
  124.     end
  125.   end
  126. end
  127. #--------------------------------------------------------------------------
  128. # ● visible の設定
  129. #--------------------------------------------------------------------------
  130. if !method_defined?("plan_enemy_hpsp_draw_visible=")
  131.   alias plan_enemy_hpsp_draw_visible= visible=
  132. end
  133. def visible=(bool)
  134.   # エネミーの場合
  135.   if @battler.is_a?(Game_Enemy)
  136.     @enemy_hpsp_window.visible = bool
  137.   end
  138.   # 元のメソッドに戻す
  139.   self.plan_enemy_hpsp_draw_visible=(bool)
  140. end
  141. #--------------------------------------------------------------------------
  142. # ● 不透明度の設定
  143. #--------------------------------------------------------------------------
  144. if !method_defined?("plan_enemy_hpsp_draw_opacity=")
  145.   alias plan_enemy_hpsp_draw_opacity= opacity=
  146. end
  147. def opacity=(n)
  148.   # 元のメソッドに戻す
  149.   self.plan_enemy_hpsp_draw_opacity=(n)
  150.   # エネミーの場合
  151.   if @battler.is_a?(Game_Enemy)
  152.     @enemy_hpsp_window.contents_opacity = n
  153.   end
  154. end
  155.  
  156. end
  157.  
  158.  
  159.  
  160.  
  161.  
  162. #==============================================================================
  163. # ■ Game_Temp
  164. #==============================================================================
  165.  
  166. class Game_Temp
  167. #--------------------------------------------------------------------------
  168. # ● 公開インスタンス変数
  169. #--------------------------------------------------------------------------
  170. attr_accessor :enemy_hpsp_refresh
  171. #--------------------------------------------------------------------------
  172. # ● オブジェクト初期化
  173. #--------------------------------------------------------------------------
  174. alias plan_enemy_hpsp_draw_initialize initialize
  175. def initialize
  176.   # 元のメソッドに戻す
  177.   plan_enemy_hpsp_draw_initialize
  178.   @enemy_hpsp_refresh = false
  179. end
  180. end
  181.  
  182. #==============================================================================
  183. # ■ Scene_Battle
  184. #==============================================================================
  185.  
  186. class Scene_Battle
  187. #--------------------------------------------------------------------------
  188. # ● プレバトルフェーズ開始 (エネミー名+アルファベット用)
  189. #--------------------------------------------------------------------------
  190. alias plan_enemy_hpsp_draw_start_phase1 start_phase1
  191. def start_phase1
  192.   $game_temp.enemy_hpsp_refresh = true
  193.   # 元のメソッドに戻す
  194.   plan_enemy_hpsp_draw_start_phase1
  195. end
  196. #--------------------------------------------------------------------------
  197. # ● パーティコマンドフェーズ開始 (エネミー名+アルファベット用)
  198. #--------------------------------------------------------------------------
  199. alias plan_enemy_hpsp_draw_start_phase3 start_phase3
  200. def start_phase3
  201.   $game_temp.enemy_hpsp_refresh = false
  202.   # 元のメソッドに戻す
  203.   plan_enemy_hpsp_draw_start_phase3
  204. end
  205. #--------------------------------------------------------------------------
  206. # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
  207. #--------------------------------------------------------------------------
  208. alias plan_enemy_hpsp_draw_update_phase4_step5 update_phase4_step5
  209. def update_phase4_step5
  210.   # 元のメソッドに戻す
  211.   plan_enemy_hpsp_draw_update_phase4_step5
  212.   $game_temp.enemy_hpsp_refresh = true
  213. end
  214. #--------------------------------------------------------------------------
  215. # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  216. #--------------------------------------------------------------------------
  217. alias plan_enemy_hpsp_draw_update_phase4_step6 update_phase4_step6
  218. def update_phase4_step6
  219.   # 元のメソッドに戻す
  220.   plan_enemy_hpsp_draw_update_phase4_step6
  221.   $game_temp.enemy_hpsp_refresh = false
  222. end
  223. end
  224.  
  225.  
  226. #==============================================================================
  227. # ■ Window_Base
  228. #==============================================================================
  229.  
  230. class Window_Base < Window
  231. #--------------------------------------------------------------------------
  232. # ● 名前の描画
  233. #--------------------------------------------------------------------------
  234. def draw_actor_name(actor, x, y, width = 120, align = 0)
  235.   self.contents.font.color = normal_color
  236.   align = 1 if $scene.is_a?(Scene_Battle)
  237.   self.contents.draw_text(x, y, width, 32, actor.name, align)
  238. end
  239. #--------------------------------------------------------------------------
  240. # ● ステートの描画
  241. #--------------------------------------------------------------------------
  242. def draw_actor_state(actor, x, y, width = 120)
  243.   # 元のメソッドに戻す
  244.   text = make_battler_state_text(actor, width, true)
  245.   self.contents.draw_text(x, y, width, 32, text, 1)
  246. end
  247. end
  248.  
  249.  
  250. #==============================================================================
  251. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  252. #==============================================================================
  253.  
  254. class Window_Base < Window
  255. def draw_actor_hp2222(actor, x, y, width = 100, height=8)
  256.    y+=3
  257.    olx = x
  258.    oly = y
  259.    w = width * actor.hp / [actor.maxhp,1].max
  260.    hp_color_1 = Color.new(255, 0, 0, 192)
  261.    hp_color_2 = Color.new(255, 255, 0, 192)
  262.    self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  263.    draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  264.    x -= 1
  265.    y += (height/4).floor
  266.    self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  267.    draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  268.    x -= 1
  269.    y += (height/4).ceil
  270.    self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  271.    draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  272.    x -= 1
  273.    y += (height/4).ceil
  274.    self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  275.    draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  276.    x = olx
  277.    y = oly-14   
  278.    # 描绘字符串 "HP"
  279.    self.contents.font.color = system_color
  280.    self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
  281.    # 计算描绘 MaxHP 所需的空间
  282.    if width - 32 >= 108
  283.      hp_x = x + width - 108
  284.      flag = true
  285.    elsif width - 32 >= 48
  286.      hp_x = x + width - 48
  287.      flag = false
  288.    end
  289.    # 描绘 HP
  290.    self.contents.font.color = actor.hp == 0 ? knockout_color :
  291.      actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  292.    self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
  293.    # 描绘 MaxHP
  294.    if flag
  295.      self.contents.font.color = normal_color
  296.      self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
  297.      self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
  298.    end   
  299. end
  300. def draw_actor_sp2222(actor, x, y, width = 100, height = 8)
  301.    y+=3
  302.    olx = x
  303.    oly = y
  304.    w = width * actor.sp / [actor.maxsp,1].max
  305.    hp_color_1 = Color.new( 0, 0, 255, 192)
  306.    hp_color_2 = Color.new( 0, 255, 255, 192)
  307.    self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  308.    draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  309.    x -= 1
  310.    y += (height/4).floor
  311.    self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  312.    draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  313.    x -= 1
  314.    y += (height/4).ceil
  315.    self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  316.    draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  317.    x -= 1
  318.    y += (height/4).ceil
  319.    self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  320.    draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  321.    x = olx
  322.    y = oly-14
  323.    # 描绘字符串 "SP"
  324.    self.contents.font.color = system_color
  325.    self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
  326.    # 计算描绘 MaxSP 所需的空间
  327.    if width - 32 >= 108
  328.      sp_x = x + width - 108
  329.      flag = true
  330.    elsif width - 32 >= 48
  331.      sp_x = x + width - 48
  332.      flag = false
  333.    end
  334.    # 描绘 SP
  335.    self.contents.font.color = actor.sp == 0 ? knockout_color :
  336.      actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  337.    self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
  338.    # 描绘 MaxSP
  339.    if flag
  340.      self.contents.font.color = normal_color
  341.      self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
  342.      self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
  343.    end   
  344. end
  345. #--------------------------------------------------------------------------
  346. # ● ライン描画 by 桜雅 在土
  347. #--------------------------------------------------------------------------
  348. def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
  349.    # 描写距離の計算。大きめに直角時の長さ。
  350.    distance = (start_x - end_x).abs + (start_y - end_y).abs
  351.    # 描写開始
  352.    if end_color == start_color
  353.      for i in 1..distance
  354.        x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  355.        y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  356.        if width == 1
  357.          self.contents.set_pixel(x, y, start_color)
  358.        else
  359.          self.contents.fill_rect(x, y, width, width, start_color)
  360.        end
  361.      end
  362.    else
  363.      for i in 1..distance
  364.        x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  365.        y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  366.        r = start_color.red * (distance-i)/distance + end_color.red * i/distance
  367.        g = start_color.green * (distance-i)/distance + end_color.green * i/distance
  368.        b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
  369.        a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
  370.        if width == 1
  371.          self.contents.set_pixel(x, y, Color.new(r, g, b, a))
  372.        else
  373.          self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
  374.        end
  375.      end
  376.    end
  377. end
  378. end


点评

我说楼主你还是用代码框好点啊……  发表于 2015-5-17 14:17
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
226 小时
注册时间
2015-5-8
帖子
329
4
发表于 2015-5-17 13:43:43 | 只看该作者
  1. x = @battler.screen_x - width / 2
  2. y = @battler.screen_y - height + 32 + PLAN_HPSP_DRAW::DRAW_Y
复制代码
請自行修改
我是妖精蕾貝卡,沉默少言,孤獨自卑。完成了一個小遊戲,歡迎試玩。同時也歡迎試玩師傅的遊戲,謝謝。
現正在努力學習事件中,有不明白的地方請各位指教。

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
126 小时
注册时间
2015-5-12
帖子
50
5
 楼主| 发表于 2015-5-17 13:49:30 | 只看该作者
已经解决,谢谢你
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
126 小时
注册时间
2015-5-12
帖子
50
6
 楼主| 发表于 2015-5-17 14:02:01 | 只看该作者
那两行放到哪里,我还是不知道在哪一行修改,请你指一下 ,第几行到第几行,谢谢
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
126 小时
注册时间
2015-5-12
帖子
50
7
 楼主| 发表于 2015-5-17 14:05:13 | 只看该作者
发错了贴子,勿怪
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
226 小时
注册时间
2015-5-8
帖子
329
8
发表于 2015-5-17 14:07:31 | 只看该作者
萨卡居 发表于 2015-5-17 14:02
那两行放到哪里,我还是不知道在哪一行修改,请你指一下 ,第几行到第几行,谢谢 ...

腳本第41、42行中。
增加或減少數值就能移動血槽。
如樓主說的移動下去的話。
y = @battler.screen_y - height + 48 + PLAN_HPSP_DRAW::DRAW_Y
將32改為48就能向下移動16像素了

评分

参与人数 1星屑 +200 收起 理由
RyanBern + 200 认可答案

查看全部评分

我是妖精蕾貝卡,沉默少言,孤獨自卑。完成了一個小遊戲,歡迎試玩。同時也歡迎試玩師傅的遊戲,謝謝。
現正在努力學習事件中,有不明白的地方請各位指教。

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
126 小时
注册时间
2015-5-12
帖子
50
9
 楼主| 发表于 2015-5-17 14:13:16 | 只看该作者
你真行,谢谢你的帮助
还有,我可以加你吗?
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
126 小时
注册时间
2015-5-12
帖子
50
10
 楼主| 发表于 2015-5-17 14:30:44 | 只看该作者
这回就真的解决了,谢谢你
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-23 01:32

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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