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

Project1

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

[已经解决] 帮忙修改个坐标,谢谢

[复制链接]

Lv1.梦旅人

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

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

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

x


如图所画,想把个个角色的战斗血条弄到固定的坐标上,请大神指点



@恋′挂机 @紫英晓狼1130 @弗雷德
脚本如下
  1. #==============================================================================
  2. # ■ Window_BattleStatus
  3. #------------------------------------------------------------------------------
  4. #  显示战斗画面同伴状态的窗口。
  5. #==============================================================================
  6. #有问题,找蚂蚁 redant修改

  7. class Window_BattleStatus < Window_Base
  8.   #--------------------------------------------------------------------------
  9.   # ● 初始化对像
  10.   #--------------------------------------------------------------------------
  11.   def initialize
  12.     super(0, 0, 640, 480)
  13.     self.contents = Bitmap.new(width - 32, height - 32)
  14.     @level_up_flags = [false, false, false, false]
  15.     #........................................................................
  16.     self.opacity = 0
  17.     @sta_back = []
  18.     @sta_output = []
  19.    # @cp_output = []
  20.   #  @hp_bitmap = RPG::Cache.picture("../system/battle/hmcp/hp_bar.png")
  21.     #@mp_bitmap = RPG::Cache.picture("../system/battle/hmcp/mp_bar.png")
  22.    # @bitmap3 = RPG::Cache.picture("../system/battle/hmcp/底.png")
  23.     # @cp_bitmap = RPG::Cache.picture("../system/battle/hmcp/cp_bar.png")
  24.    # @cp_output = []
  25.    # @cp_back_bar = Sprite.new
  26.     #@cp_back_bar.bitmap = Bitmap.new("Graphics/system/battle/hmcp/cp_back_bar")
  27.    ## @cp_back_bar.x = 450
  28.    # @cp_back_bar.y = 25
  29.     #@cp_back_bar.z = self.z + 1
  30.    # @actor_cp_sprite = []
  31.    # @actor_cp_sprite_back = []
  32. #  @xy_window.visible = true  
  33.    @xy_window = Window_xy.new
  34.    @xy_window.x = -16
  35.    @xy_window.y = -16
  36.    @xy_window.opacity = 0

  37.     for actor_index in 1..$game_party.actors.size
  38. #      @cp_output[actor_index] = Sprite.new
  39.      # @cp_output[actor_index].bitmap = Bitmap.new(133, 78)
  40.     #  @cp_output[actor_index].x = 100 + (actor_index - 1) * 133
  41.     #  @cp_output[actor_index].y = 480 - 78 - 10
  42.     #  @cp_output[actor_index].z = self.z + 2
  43. #      @cp_output[actor_index].bitmap.clear
  44.       @sta_back[actor_index] = Sprite.new
  45.       @sta_back[actor_index].bitmap = Bitmap.new("Graphics/System/Battle/sta_back/" + $game_party.actors[actor_index - 1].name + "战斗.png")
  46.       @sta_back[actor_index].x = 10
  47.       @sta_back[actor_index].y = 220 + (actor_index - 1) * 80
  48.       @sta_back[actor_index].z = self.z + 1
  49.      @sta_output[actor_index] = Sprite.new
  50.       @sta_output[actor_index].bitmap = Bitmap.new(133, 78)
  51.      @sta_output[actor_index].x = 75
  52.       @sta_output[actor_index].y = 232 + (actor_index - 1) * 80
  53.       @sta_output[actor_index].z = self.z + 2
  54.       @sta_output[actor_index].bitmap.clear
  55.       @sta_output[actor_index].bitmap.font.size = 11
  56.       @sta_output[actor_index].bitmap.font.name = "黑体"
  57. #      hp_width = $game_party.actors[actor_index - 1].hp * @hp_bitmap.width/$game_party.actors[actor_index - 1].maxhp
  58. #     hp_rect = Rect.new(0, 0, hp_width, 5)
  59.      # mp_width = $game_party.actors[actor_index - 1].sp * @mp_bitmap.width/$game_party.actors[actor_index - 1].maxsp
  60.     #  mp_rect = Rect.new(0, 0, mp_width, 5)
  61.       
  62.      # @src_rect3 = Rect.new(0,0,@bitmap3.width, @bitmap3.height)
  63.      # self.contents.blt(10,220, @bitmap3, @src_rect3)
  64.       
  65. #      @sta_output[actor_index].bitmap.blt(66, 44, @hp_bitmap, hp_rect)
  66. #     @sta_output[actor_index].bitmap.blt(66, 64, @mp_bitmap, mp_rect)
  67. #      @sta_output[actor_index].bitmap.blt(66, 54, @bitmap3, @src_rect3)
  68.       
  69.       @sta_output[actor_index].bitmap.font.color.set(255, 0, 0)
  70.       @sta_output[actor_index].bitmap.draw_text(80, 31, 77, 11,$game_party.actors[actor_index - 1].hp.to_s + "/" + $game_party.actors[actor_index - 1].maxhp.to_s)
  71.       @sta_output[actor_index].bitmap.font.color.set(0, 0, 255)
  72.      @sta_output[actor_index].bitmap.draw_text(80, 51, 77, 11,$game_party.actors[actor_index - 1].sp.to_s + "/" + $game_party.actors[actor_index - 1].maxsp.to_s)
  73.     end
  74.     #........................................................................
  75.     refresh
  76.   end
  77.   #--------------------------------------------------------------------------
  78.   # ● 释放
  79.   #--------------------------------------------------------------------------
  80.   def dispose
  81.     super
  82.      @xy_window.dispose
  83.    # @hp_bitmap.bitmap.dispose
  84.    #@hp_bitmap.dispose
  85.   #  @mp_bitmap.bitmap.dispose
  86.    # @mp_bitmap.dispose
  87.     #@cp_bitmap.bitmap.dispose
  88.    # @cp_bitmap.dispose
  89.     for actor_index in 1..$game_party.actors.size
  90.       @sta_back[actor_index].bitmap.dispose
  91.       @sta_back[actor_index].dispose
  92.       @sta_output[actor_index].bitmap.dispose
  93.       @sta_output[actor_index].dispose
  94.      # @cp_output[actor_index].bitmap.dispose
  95.      # @cp_output[actor_index].dispose
  96.     end
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # ● 设置升级标志
  100.   #     actor_index : 角色索引
  101.   #--------------------------------------------------------------------------
  102.   def level_up(actor_index)
  103.     @level_up_flags[actor_index] = true
  104.   end
  105.   #......................................................................
  106.   #--------------------------------------------------------------------------
  107.   # ● 设置正在攻击标志
  108.   #     actor_index : 角色索引
  109.   #--------------------------------------------------------------------------
  110.   def in_atk(actor_index)
  111.    @sta_back[actor_index + 1].bitmap = Bitmap.new("Graphics/System/Battle/sta_back/" + $game_party.actors[actor_index].name + "战斗1.png")
  112.   end
  113.   #--------------------------------------------------------------------------
  114.   # ● 设置不在攻击标志
  115.   #     actor_index : 角色索引
  116.   #--------------------------------------------------------------------------
  117.   def out_atk(actor_index)
  118.     @sta_back[actor_index + 1].bitmap = Bitmap.new("Graphics/System/Battle/sta_back/" + $game_party.actors[actor_index].name + "战斗.png")
  119.   end
  120.   #......................................................................
  121.   #--------------------------------------------------------------------------
  122.   # ● 刷新
  123.   #--------------------------------------------------------------------------
  124.   def refresh
  125.     self.contents.clear
  126.     @item_max = $game_party.actors.size
  127.     for i in 0...$game_party.actors.size
  128.       actor = $game_party.actors[i]
  129.       #......................................................................
  130.        actor_x = i * 160 + 145
  131.        actor_y = i * 80 + 220
  132.       @sta_output[i + 1].bitmap.clear
  133.     # hp_width = $game_party.actors[i].hp * @hp_bitmap.width/$game_party.actors[i].maxhp
  134.      # hp_rect = Rect.new(0, 0, hp_width, 5)
  135.     #  mp_width = $game_party.actors[i].sp * @mp_bitmap.width/$game_party.actors[i].maxsp
  136.     #  mp_rect = Rect.new(0, 0, mp_width, 5)
  137. #      @sta_output[i + 1].bitmap.blt(66, 44, @hp_bitmap, hp_rect)
  138. #     @sta_output[i + 1].bitmap.blt(66, 64, @mp_bitmap, mp_rect)
  139.       @sta_output[i + 1].bitmap.font.color.set(255, 0, 0)
  140.       @sta_output[i + 1].bitmap.draw_text(80, 31, 77, 11,$game_party.actors[i].hp.to_s + "/" + $game_party.actors[i].maxhp.to_s)
  141.       @sta_output[i + 1].bitmap.font.color.set(0, 0, 255)
  142.       @sta_output[i + 1].bitmap.draw_text(80, 51, 77, 11,$game_party.actors[i].sp.to_s + "/" + $game_party.actors[i].maxsp.to_s)
  143.       #......................................................................
  144.       if @level_up_flags[i]
  145.         self.contents.font.color = Color.new(255,5,5)
  146.          self.contents.font.size = 16
  147.         self.contents.draw_text(100, actor_y - 220, 640 , 480, "等级提升!")
  148.         $data_system_level_up_me = "Audio/ME/dengji"
  149.           Audio.me_play($data_system_level_up_me)
  150.       else
  151.         draw_actor_state(actor, 120, actor_y)
  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 = 255 #if self.contents_opacity > 1
  163.     else
  164.       self.contents_opacity = 255 #if self.contents_opacity < 255
  165.     end
  166.   end
  167. end
复制代码
第2 个脚本
  1. #图片血槽显示Ver 1.0(清爽版)
  2. #              by逐月

  3. #描画HP槽
  4. def HP (actor,x,y)         
  5. @bitmap3 = Bitmap.new("Graphics/Pictures/底")
  6. @src_rect3 = Rect.new(0,0,@bitmap3.width, @bitmap3.height)
  7. self.contents.blt(x,y, @bitmap3, @src_rect3)
  8. #HP显示
  9. @bitmap3 = Bitmap.new("Graphics/Pictures/hp")
  10. w3 = @bitmap3.width * actor.hp/actor.maxhp
  11. @src_rect3 = Rect.new(0,0,w3, @bitmap3.height)
  12. self.contents.blt(x+4,y+2, @bitmap3, @src_rect3)
  13. end
  14. #描画SP槽
  15. def SP (actor,x,y)
  16. @bitmap1 = Bitmap.new("Graphics/Pictures/底")
  17. @src_rect1 = Rect.new(0,0,@bitmap1.width, @bitmap1.height)
  18. self.contents.blt(x,y, @bitmap1, @src_rect1)
  19. #SP显示           
  20. @bitmap1 = Bitmap.new("Graphics/Pictures/sp")
  21. w1 = @bitmap1.width * actor.sp/actor.maxsp
  22. @src_rect1 = Rect.new(0,0,w1, @bitmap1.height)
  23. self.contents.blt(x+4,y+2, @bitmap1, @src_rect1)
  24. end

  25. #==============================================================================
  26. # ■ Window_BattleStatus
  27. #==============================================================================
  28. class Window_BattleStatus < Window_Base
  29. #--------------------------------------------------------------------------
  30. # ● 初始化
  31. #--------------------------------------------------------------------------
  32. alias xrxs_bp3_refresh refresh
  33. def refresh
  34.    xrxs_bp3_refresh
  35.    @item_max = $game_party.actors.size
  36.     for i in 0...$game_party.actors.size
  37.      actor = $game_party.actors[i]
  38.         bitmap = Bitmap.new("Graphics/system/menu/back/" + actor.name + "_name.png")
  39.       src_rect = Rect.new(0, 0, 120, 66)
  40.      case i
  41.        when 0
  42.         x = 145
  43.         y = 259
  44.           #draw_actor_name(actor, 400 - 40,420-5)
  45.       
  46.       self.contents.blt(345, 405 , bitmap, src_rect)
  47.       
  48.       when 1
  49.         x = 145
  50.         y = 339
  51.          # draw_actor_name(actor, 470 - 40,350-15 )
  52.            self.contents.blt(420, 330 , bitmap, src_rect)
  53.        when 2
  54.         x = 145
  55.         y = 419
  56.          # draw_actor_name(actor, 540 - 30,280-20)
  57.            self.contents.blt(500, 255 , bitmap, src_rect)
  58.        when 3
  59.         x = 145
  60.         y = 499
  61.           #draw_actor_name(actor, 610 - 40 ,210 )
  62.             self.contents.blt(560, 190 , bitmap, src_rect)
  63.           end
  64.       ###########################一切自改##############################
  65.      HP(actor, x-10, y)
  66.      SP(actor, x-10, y + 18)
  67.      # draw_actor_name(actor, x ,y )
  68.   
  69.      #######################################一切自改###############
  70.    end
  71. end

  72. end
复制代码

   
【RMXP共享】50个脚本整合的系统

Lv1.梦旅人

薄凉看客

梦石
0
星屑
50
在线时间
1269 小时
注册时间
2010-6-20
帖子
1316
2
发表于 2014-2-12 18:48:55 | 只看该作者
你发的第二段脚本

case i

分歧同伴角色
那可以直接改


when 0
什么什么
就是第一个同伴的坐标
when 1
第二个同伴的坐标


直接改

点评

个人觉得是第一个脚本39-58行处修改,但鄙人不会改  发表于 2014-2-12 20:02

评分

参与人数 1星屑 +90 收起 理由
myownroc + 90 我很赞同

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
439 小时
注册时间
2013-3-2
帖子
710
3
 楼主| 发表于 2014-2-12 19:44:53 | 只看该作者


只是血条变了。。。
人物头像那些没变

@恋′挂机

   
【RMXP共享】50个脚本整合的系统
回复 支持 反对

使用道具 举报

Lv1.梦旅人

薄凉看客

梦石
0
星屑
50
在线时间
1269 小时
注册时间
2010-6-20
帖子
1316
4
发表于 2014-2-12 20:07:09 | 只看该作者
第一段脚本48行

  1. @sta_back[actor_index].x = 10
  2. @sta_back[actor_index].y = 220 + (actor_index - 1) * 80
复制代码
53行

  1. @sta_output[actor_index].x = 75
  2. @sta_output[actor_index].y = 232 + (actor_index - 1) * 80
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
439 小时
注册时间
2013-3-2
帖子
710
5
 楼主| 发表于 2014-2-21 13:00:36 | 只看该作者
@myownroc 结贴,忘记有这贴了

   
【RMXP共享】50个脚本整合的系统
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-30 15:32

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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