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

Project1

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

如何在平时显示血条?

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
60
在线时间
1 小时
注册时间
2008-2-17
帖子
12
跳转到指定楼层
1
发表于 2008-5-2 19:22:03 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
如题。
注意是平时
就要单独血条 其他都不要

最好还要有显示金钱的。。
头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-6-18
帖子
705

VX城市地图大赛季军

2
发表于 2008-5-2 19:24:40 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
27 小时
注册时间
2008-2-13
帖子
1740
3
发表于 2008-5-2 19:24:45 | 只看该作者
原理教学:
http://rpg.blue/web/htm/news756.htm
充分利用值槽:
http://rpg.blue/web/htm/news954.htm
好吧,果然换个签名就没人认识我了。我承认我被时间埋没了
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
27 小时
注册时间
2008-2-13
帖子
1740
4
发表于 2008-5-2 19:37:27 | 只看该作者
如果是地图上显示血槽的话,用此脚本
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================


  4. #增加显示血槽的功能 by KING  

  5. #◆◇◆◇◆-----XRXS54. マップ上で簡易ウィンドウ表示 ver1.0 -----◇◆◇◆◇
  6. # by 刻宮

  7. # 「ディフォルト機能 & 仕様」
  8. #  ・$WIN_2 = true。としても、スイッチがONでかつ、アクターが存在しなければ
  9. #   ウィンドウは表示されません。この3要素が揃った時にウィンドウを表示します。
  10. #  ・逆にこの要素が一つでも欠けるとウィンドウは自動的に非表示になります。
  11. #  ・ツクール開始時はスイッチはOFFなので、ONにしないと表示されません。
  12. #------------------------------------------------------------------
  13. # カスタマイズポイント
  14. #(*存在しないスイッチを指定されるとエラーになります。)


  15. #----------------------------------------------------------------
  16. # 使用说明(66RPG提示:本脚本其实难度不是很高,建议学习RGSS略有心得
  17. #           的人尝试自己编写一个同类功能窗口)
  18. #----------------------------------------------------------------
  19. WIN_1     = true  # 是否使用1号窗口,true为使用,false为不使用
  20. SWITVH_1  = 40    # 当此编号开关打开的时候窗口显示。如设置为40则40号开关打开,1号窗口显示
  21. OPACITY_1 = 144   # 1号窗口透明度
  22. X_1       = 0     # 1号窗口X坐标
  23. Y_1       = 384   # 1号窗口Y坐标

  24. $WIN_2    = true  # 是否使用2号窗口,true为使用,false为不使用
  25. SWITVH_2  = 41    # 当此编号开关打开的时候窗口显示。如设置为41则41号开关打开,2号窗口显示
  26. OPACITY_2 = 144   # 2号窗口透明度
  27. X_2       = 160   # 2号窗口X坐标
  28. Y_2       = 384   # 2号窗口Y坐标

  29. WIN_3     = true  # 是否使用3号窗口,true为使用,false为不使用
  30. SWITVH_3  = 42    # 当此编号开关打开的时候窗口显示。如设置为42则42号开关打开,3号窗口显示
  31. OPACITY_3 = 144   # 3号窗口透明度
  32. X_3       = 320   # 3号窗口X坐标
  33. Y_3       = 384   # 3号窗口Y坐标

  34. WIN_4     = true  # 是否使用4号窗口,true为使用,false为不使用
  35. SWITVH_4  = 43    # 当此编号开关打开的时候窗口显示。如设置为43则43号开关打开,4号窗口显示
  36. OPACITY_4 = 144   # 4号窗口透明度
  37. X_4       = 480   # 4号窗口X坐标
  38. Y_4       = 384   # 4号窗口Y坐标

  39. SET_SP    = [true,true,true,true]# 决定各个窗口是否显示SP数值,true为显示,false为不显示。
  40. OPTION    = 44    # 决定在对话的时候是否让窗口隐藏的开关编号。
  41.                    # 比如设置为44,则当44号开关打开,则在对话的时候窗口隐藏
  42.                    # 否则窗口不隐藏。
  43.                   
  44.                   
  45. #=========================================================================
  46. # ■ Scene_Map
  47. #=========================================================================
  48. class Scene_Map
  49. #---------------------------------------------------------------------
  50. # ● フレーム更新
  51. #---------------------------------------------------------------------
  52. alias main_tokimiya main
  53. def main
  54.    # 簡易ウィンドウ1を作成
  55.      @simple_window1 = Window_MapStatus.new(X_1,Y_1,0)
  56.      @simple_window1.opacity = OPACITY_1
  57.      @simple_window1.visible = $game_switches[SWITVH_1]
  58.      unless $game_party.actors.size > 0
  59.        @simple_window1.visible = false
  60.      end
  61.    # 簡易ウィンドウ2を作成
  62.      @simple_window2 = Window_MapStatus.new(X_2,Y_2,1)
  63.      @simple_window2.opacity = OPACITY_2
  64.      @simple_window2.visible = $game_switches[SWITVH_2]
  65.      unless $game_party.actors.size > 1
  66.        @simple_window2.visible = false
  67.      end
  68.    # 簡易ウィンドウ3を作成
  69.      @simple_window3 = Window_MapStatus.new(X_3,Y_3,2)
  70.      @simple_window3.opacity = OPACITY_3
  71.      @simple_window3.visible = $game_switches[SWITVH_3]
  72.      unless $game_party.actors.size > 2
  73.        @simple_window3.visible = false
  74.      end
  75.    # 簡易ウィンドウ4を作成
  76.      @simple_window4 = Window_MapStatus.new(X_4,Y_4,3)
  77.      @simple_window4.opacity = OPACITY_4
  78.      @simple_window4.visible = $game_switches[SWITVH_4]
  79.      unless $game_party.actors.size > 3
  80.        @simple_window4.visible = false
  81.      end
  82.    
  83.      main_tokimiya   # 旧メソッドの呼び出し
  84.    
  85.    # 簡易ウィンドウの解放
  86.      @simple_window1.dispose
  87.      @simple_window2.dispose
  88.      @simple_window3.dispose
  89.      @simple_window4.dispose
  90. end

  91. #---------------------------------------------------------------------
  92. # ● フレーム更新
  93. #---------------------------------------------------------------------
  94. alias update_tokimiya update
  95. def update
  96.    update_tokimiya   # 旧メソッドの呼び出し
  97.    # 以前のパラメーターと相違があれば、内容を更新する。
  98.    #
  99.    # ウィンドウ1の更新。
  100.    if WIN_1 == true and $game_party.actors.size > 0
  101.      # データの更新
  102.      actor = $game_party.actors[0]
  103.      factor_1 = @simple_window1.before_1[0] != actor.name
  104.      factor_2 = @simple_window1.before_1[1] != actor.hp
  105.      factor_3 = @simple_window1.before_1[2] != actor.sp
  106.      if factor_1 or factor_2 or factor_3
  107.        @simple_window1.before_1[0] = actor.name
  108.        @simple_window1.before_1[1] = actor.hp
  109.        @simple_window1.before_1[2] = actor.sp
  110.        @simple_window1.refresh(0)
  111.      end
  112.      # 非表示機能の実行
  113.      if @message_window.visible == true and $game_switches[OPTION] == true
  114.        @simple_window1.before_1[3] = false
  115.        @simple_window1.visible = false
  116.      elsif @simple_window1.before_1[3] != $game_switches[SWITVH_1]
  117.        @simple_window1.before_1[3] = $game_switches[SWITVH_1]
  118.        @simple_window1.visible = $game_switches[SWITVH_1]
  119.      end
  120.    end
  121.    
  122.    # ウィンドウ2の更新。
  123.    if $WIN_2 == true and $game_party.actors.size > 1
  124.      # データの更新
  125.      actor = $game_party.actors[1]
  126.      factor_1 = @simple_window2.before_2[0] != actor.name
  127.      factor_2 = @simple_window2.before_2[1] != actor.hp
  128.      factor_3 = @simple_window2.before_2[2] != actor.sp
  129.      if factor_1 or factor_2 or factor_3
  130.        @simple_window2.before_2[0] = actor.name
  131.        @simple_window2.before_2[1] = actor.hp
  132.        @simple_window2.before_2[2] = actor.sp
  133.        @simple_window2.refresh(1)
  134.        # ウィンドウを強制的に生成
  135.        @simple_window2.before_2[3] = true
  136.        @simple_window2.visible = true
  137.      end
  138.      # 非表示機能の実行
  139.      if @message_window.visible == true and $game_switches[OPTION] == true
  140.        @simple_window2.before_2[3] = false
  141.        @simple_window2.visible = false
  142.      elsif @simple_window2.before_2[3] != $game_switches[SWITVH_2]
  143.        @simple_window2.before_2[3] = $game_switches[SWITVH_2]
  144.        @simple_window2.visible = $game_switches[SWITVH_2]
  145.      end
  146.    # アクターが存在しないのにウィンドウが表示されたままの場合。
  147.    elsif @simple_window2.visible == true and @simple_window2.before_2 != nil
  148.      # ウィンドウを消去。
  149.      @simple_window2.before_2[3] = false
  150.      @simple_window2.visible = false
  151.    end
  152.    
  153.    # ウィンドウ3の更新。
  154.    if WIN_3 == true and $game_party.actors.size > 2
  155.      # データの更新
  156.      actor = $game_party.actors[2]
  157.      factor_1 = @simple_window3.before_3[0] != actor.name
  158.      factor_2 = @simple_window3.before_3[1] != actor.hp
  159.      factor_3 = @simple_window3.before_3[2] != actor.sp
  160.      if factor_1 or factor_2 or factor_3
  161.        @simple_window3.before_3[0] = actor.name
  162.        @simple_window3.before_3[1] = actor.hp
  163.        @simple_window3.before_3[2] = actor.sp
  164.        @simple_window3.refresh(2)
  165.        # ウィンドウを強制的に生成
  166.        @simple_window3.before_3[3] = true
  167.        @simple_window3.visible = true
  168.      end
  169.      # 非表示機能の実行
  170.      if @message_window.visible == true and $game_switches[OPTION] == true
  171.        @simple_window3.before_3[3] = false
  172.        @simple_window3.visible = false
  173.      elsif @simple_window3.before_3[3] != $game_switches[SWITVH_3]
  174.        @simple_window3.before_3[3] = $game_switches[SWITVH_3]
  175.        @simple_window3.visible = $game_switches[SWITVH_3]
  176.      end
  177.    # アクターが存在しないのにウィンドウが表示されたままの場合。
  178.    elsif @simple_window3.visible == true and @simple_window3.before_3 != nil
  179.      # ウィンドウを消去。
  180.      @simple_window3.before_3[3] = false
  181.      @simple_window3.visible = false
  182.    end
  183.    
  184.    # ウィンドウ4の更新。
  185.    if WIN_4 == true and $game_party.actors.size > 3
  186.      # データの更新
  187.      actor = $game_party.actors[3]
  188.      factor_1 = @simple_window4.before_4[0] != actor.name
  189.      factor_2 = @simple_window4.before_4[1] != actor.hp
  190.      factor_3 = @simple_window4.before_4[2] != actor.sp
  191.      if factor_1 or factor_2 or factor_3
  192.        @simple_window4.before_4[0] = actor.name
  193.        @simple_window4.before_4[1] = actor.hp
  194.        @simple_window4.before_4[2] = actor.sp
  195.        @simple_window4.refresh(3)
  196.        # ウィンドウを強制的に生成
  197.        @simple_window4.before_4[3] = true
  198.        @simple_window4.visible = true
  199.      end
  200.      # 非表示機能の実行
  201.      if @message_window.visible == true and $game_switches[OPTION] == true
  202.        @simple_window4.before_4[3] = false
  203.        @simple_window4.visible = false
  204.      elsif @simple_window4.before_4[3] != $game_switches[SWITVH_4]
  205.        @simple_window4.before_4[3] = $game_switches[SWITVH_4]
  206.        @simple_window4.visible = $game_switches[SWITVH_4]
  207.      end
  208.    # アクターが存在しないのにウィンドウが表示されたままの場合。
  209.    elsif @simple_window4.visible == true and @simple_window4.before_4 != nil
  210.      # ウィンドウを消去。
  211.      @simple_window4.before_4[3] = false
  212.      @simple_window4.visible = false
  213.    end
  214. end
  215. end



  216. #=========================================================================
  217. # ■ Window_MapStatus,脚本来自www.66rpg.com,转载请注意说明
  218. #=========================================================================
  219. class Window_MapStatus < Window_Base
  220. #--------------------------------------------------------------------------
  221. # ○ 公開インスタンス変数
  222. #--------------------------------------------------------------------------
  223. attr_accessor   :before_1              # 更新前のウィンドウ1のパラメーター
  224. attr_accessor   :before_2              # 更新前のウィンドウ2のパラメーター
  225. attr_accessor   :before_3              # 更新前のウィンドウ3のパラメーター
  226. attr_accessor   :before_4              # 更新前のウィンドウ4のパラメーター
  227. #---------------------------------------------------------------------
  228. # ● フレーム更新
  229. #---------------------------------------------------------------------
  230. def initialize(x,y,id)
  231.    super(x,y,160,96)
  232.    self.contents = Bitmap.new(width - 32, height - 32)
  233.    self.contents.font.size = 18
  234.    @before_1=[]
  235.    @before_2=[]
  236.    @before_3=[]
  237.    @before_4=[]
  238.     # 現段階のアクターのパラメーターと可視状態を記憶。
  239.    data
  240.    # 項目の描画。
  241.    refresh(id)
  242. end
  243. #--------------------------------------------------------------------------
  244. # ● 項目の描画
  245. #--------------------------------------------------------------------------
  246. def data
  247.    # アクター1の記憶(ただし、パーティが1名以上の場合)
  248.    if $game_party.actors.size > 0
  249.      actor = $game_party.actors[0]
  250.      @before_1 = [actor.name, actor.hp, actor.sp,true]
  251.    end
  252.    # アクター2の記憶(ただし、パーティが2名以上の場合)
  253.    if $game_party.actors.size > 1
  254.      actor = $game_party.actors[1]
  255.      @before_2 = [actor.name, actor.hp, actor.sp,true]
  256.    end
  257.    # アクター3の記憶(ただし、パーティが3名以上の場合)
  258.    if $game_party.actors.size > 2
  259.      actor = $game_party.actors[2]
  260.      @before_3 = [actor.name, actor.hp, actor.sp,true]
  261.    end
  262.    # アクター3の記憶(ただし、パーティが4名以上の場合)
  263.    if $game_party.actors.size > 3
  264.      actor = $game_party.actors[3]
  265.      @before_4 = [actor.name, actor.hp, actor.sp,true]
  266.    end
  267. end
  268. #--------------------------------------------------------------------------
  269. # ● 項目の描画
  270. #--------------------------------------------------------------------------
  271. def refresh(id)
  272.    # 再描画のために一旦内容を破棄する
  273.    self.contents.clear
  274.    # 対応するアクターがいなければ、何もせずに終了する。
  275.    actor = $game_party.actors[id]
  276.    if actor == nil
  277.      return
  278.    end
  279.    # 名前の描画
  280.    draw_actor_name(actor, 0, -5)
  281.    # HPの描画
  282.    if SET_SP[id]
  283.      draw_actor_hp_custom(actor, 0, 18)
  284.    else
  285.      draw_actor_hp_custom(actor, 0, 28)
  286.    end
  287.    # SPの描画
  288.    if SET_SP[id]
  289.      draw_actor_sp_custom(actor, 0, 36)
  290.    end
  291. end

  292. #--------------------------------------------------------------------------
  293. # ● HP の描画
  294. #     actor : アクター
  295. #     x     : 描画先 X 座標
  296. #     y     : 描画先 Y 座標
  297. #     width : 描画先の幅
  298. #--------------------------------------------------------------------------
  299. def draw_actor_hp_custom(actor, x, y, width = 144)
  300.      draw_actor_hp2222(actor, x, y+10, width = 100, height=8)#------------------血条显示----------------------
  301.    # 文字列 "HP" を描画
  302.    #self.contents.font.color = system_color
  303.    #self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
  304.    # MaxHP を描画するスペースがあるか計算
  305.    if width - 32 >= 108
  306.      hp_x = x + width - 108
  307.      flag = true
  308.    elsif width - 32 >= 48
  309.      hp_x = x + width - 48
  310.      flag = false
  311.    end
  312.    # HP を描画
  313.    self.contents.font.color = actor.hp == 0 ? knockout_color :
  314.      actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  315.    #self.contents.draw_text(hp_x - 12, y, 48, 32, actor.hp.to_s, 2)
  316.    # MaxHP を描画
  317.    if flag
  318.      self.contents.font.color = normal_color
  319.      #self.contents.draw_text(hp_x + 48 - 12, y, 12, 32, "/", 1)
  320.      #self.contents.draw_text(hp_x + 60 - 12, y, 48, 32, actor.maxhp.to_s)
  321.    end
  322. end
  323. #--------------------------------------------------------------------------
  324. # ● SP の描画
  325. #     actor : アクター
  326. #     x     : 描画先 X 座標
  327. #     y     : 描画先 Y 座標
  328. #     width : 描画先の幅
  329. #--------------------------------------------------------------------------
  330. def draw_actor_sp_custom(actor, x, y, width = 144)
  331.      draw_actor_sp2222(actor, x, y+10, width = 100, height=8)#------------------血条显示----------------------   
  332. # 文字列 "SP" を描画
  333.    #self.contents.font.color = system_color
  334.    #self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
  335.    # MaxSP を描画するスペースがあるか計算
  336.    if width - 32 >= 108
  337.      sp_x = x + width - 108
  338.      flag = true
  339.    elsif width - 32 >= 48
  340.      sp_x = x + width - 48
  341.      flag = false
  342.    end
  343.    # SP を描画
  344.    self.contents.font.color = actor.sp == 0 ? knockout_color :
  345.      actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  346.    #self.contents.draw_text(sp_x - 12, y, 48, 32, actor.sp.to_s, 2)
  347.    # MaxSP を描画
  348.    if flag
  349.      self.contents.font.color = normal_color
  350.      #self.contents.draw_text(sp_x + 48 - 12, y, 12, 32, "/", 1)
  351.      #self.contents.draw_text(sp_x + 60 - 12, y, 48, 32, actor.maxsp.to_s)
  352.    end
  353. end
  354. end
  355. #==============================================================================
  356. # Window_Base
  357. #==============================================================================

  358. class Window_Base < Window
  359. def draw_actor_hp2222(actor, x, y, width = 100, height=8)
  360.   y+=3
  361.   olx = x
  362.   oly = y
  363.   w = width * actor.hp / [actor.maxhp,1].max
  364.   hp_color_1 = Color.new(255, 0, 0, 192)
  365.   hp_color_2 = Color.new(255, 255, 0, 192)
  366.   self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  367.   draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  368.   x -= 1
  369.   y += (height/4).floor
  370.   self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  371.   draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  372.   x -= 1
  373.   y += (height/4).ceil
  374.   self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  375.   draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  376.   x -= 1
  377.   y += (height/4).ceil
  378.   self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  379.   draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  380.   x = olx
  381.   y = oly-14  
  382.   # 描绘字符串 "HP"
  383.   self.contents.font.color = system_color
  384.   self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
  385.   # 计算描绘 MaxHP 所需的空间
  386.   if width - 32 >= 108
  387.     hp_x = x + width - 108
  388.     flag = true
  389.   elsif width - 32 >= 48
  390.     hp_x = x + width - 48
  391.     flag = false
  392.   end
  393.   # 描绘 HP
  394.   self.contents.font.color = actor.hp == 0 ? knockout_color :
  395.     actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  396.   self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
  397.   # 描绘 MaxHP
  398.   if flag
  399.     self.contents.font.color = normal_color
  400.     self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
  401.     self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
  402.   end   
  403. end
  404. def draw_actor_sp2222(actor, x, y, width = 100, height = 8)
  405.   y+=3
  406.   olx = x
  407.   oly = y
  408.   w = width * actor.sp / [actor.maxsp,1].max
  409.   hp_color_1 = Color.new( 0, 0, 255, 192)
  410.   hp_color_2 = Color.new( 0, 255, 255, 192)
  411.   self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  412.   draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  413.   x -= 1
  414.   y += (height/4).floor
  415.   self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  416.   draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  417.   x -= 1
  418.   y += (height/4).ceil
  419.   self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  420.   draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  421.   x -= 1
  422.   y += (height/4).ceil
  423.   self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  424.   draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  425.   x = olx
  426.   y = oly-14
  427.   # 描绘字符串 "SP"
  428.   self.contents.font.color = system_color
  429.   self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
  430.   # 计算描绘 MaxSP 所需的空间
  431.   if width - 32 >= 108
  432.     sp_x = x + width - 108
  433.     flag = true
  434.   elsif width - 32 >= 48
  435.     sp_x = x + width - 48
  436.     flag = false
  437.   end
  438.   # 描绘 SP
  439.   self.contents.font.color = actor.sp == 0 ? knockout_color :
  440.     actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  441.   self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
  442.   # 描绘 MaxSP
  443.   if flag
  444.     self.contents.font.color = normal_color
  445.     self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
  446.     self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
  447.   end   
  448. end
  449. #--------------------------------------------------------------------------
  450. # ● ライン描画 by 桜雅 在土
  451. #--------------------------------------------------------------------------
  452. def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
  453.   # 描写距離の計算。大きめに直角時の長さ。
  454.   distance = (start_x - end_x).abs + (start_y - end_y).abs
  455.   # 描写開始
  456.   if end_color == start_color
  457.     for i in 1..distance
  458.       x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  459.       y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  460.       if width == 1
  461.         self.contents.set_pixel(x, y, start_color)
  462.       else
  463.         self.contents.fill_rect(x, y, width, width, start_color)
  464.       end
  465.     end
  466.   else
  467.     for i in 1..distance
  468.       x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  469.       y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  470.       r = start_color.red * (distance-i)/distance + end_color.red * i/distance
  471.       g = start_color.green * (distance-i)/distance + end_color.green * i/distance
  472.       b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
  473.       a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
  474.       if width == 1
  475.         self.contents.set_pixel(x, y, Color.new(r, g, b, a))
  476.       else
  477.         self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
  478.       end
  479.     end
  480.   end
  481. end
  482. end
  483. #==============================================================================
  484. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  485. #==============================================================================
复制代码
好吧,果然换个签名就没人认识我了。我承认我被时间埋没了
回复 支持 反对

使用道具 举报

Lv1.梦旅人

蚂蚁卡卡

梦石
0
星屑
116
在线时间
66 小时
注册时间
2007-12-16
帖子
3081
5
发表于 2008-5-3 04:28:32 | 只看该作者
楼主是要仿制网游大话梦幻的吧 正好我也要
收了
谢谢
《隋唐乱》完整解密版点击进入
米兰,让我怎么说离开……

曾经我也是一个有志青年,直到我膝盖中了一箭……

《隋唐乱》博客地址
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-7-23 07:11

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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