查看: 1791|回复: 1

[已经解决] [已經解決]寫了顯示總戰力的腳本,但沒有畫出文字

[复制链接]
梦石
0
星屑
1388
在线时间
343 小时
注册时间
2016-7-17
回帖
82
发表于 2017-3-22 10:05:48 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 b200077 于 2017-3-22 14:17 编辑

總戰力腳本class Window_EquipStatus < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y, window_width, window_height)
    @actor = nil
    @temp_actor = nil
    @hurt = 0
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  alias new_refresh refresh
  def new_refresh
    refresh
    contents.clear
    draw_actor_name(@actor, 4, 0) if @actor
    6.times {|i| draw_item(0, line_height * (1 + i), 2 + i) }
    draw_current_param2(x + 150 , 110) if @actor
  end
  #--------------------------------------------------------------------------
  # ● 绘制總戰力
  #--------------------------------------------------------------------------
  def draw_current_param2(x, y)
       @hurt = 0
    6.times{|n| @hurt + @actor.param(2 + n) }
    change_color(system_color)
    draw_text(x, y, 50, line_height, @hurt, 2)
  end  
end


這裡總戰力指的是全部裝備欄能力加總
梦石
0
星屑
6375
在线时间
1473 小时
注册时间
2015-7-25
回帖
609

极短25参与开拓者

发表于 2017-3-22 11:27:08 | 显示全部楼层
本帖最后由 魔法丶小肉包 于 2017-3-22 11:33 编辑

稍作修改,楼主可以参考一下
[pre lang="ruby"]class Window_EquipStatus < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y, window_width, window_height)
    @actor = nil
    @temp_actor = nil
    @hurt = 0
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    draw_actor_name(@actor, 4, 0) if @actor
    6.times {|i| draw_item(0, line_height * (1 + i), 2 + i) }
    draw_current_param2(0,0) if @actor
  end
  #--------------------------------------------------------------------------
  # ● 绘制總戰力
  #--------------------------------------------------------------------------
  def draw_current_param2(x, y)
       @hurt = 0
    6.times{|n| @hurt + @actor.param(2 + n) }
    change_color(system_color)
    draw_text(x-25, y, self.width, line_height, @hurt.to_s, 2)
  end  
end[/pre]

还有,应该是6.times{|n| @hurt += @actor.param(2 + n) }
6.times{|n| @hurt + @actor.param(2 + n) }的话@hurt永远是0

评分

参与人数 1梦石 +1 收起 理由
RaidenInfinity + 1 认可答案

查看全部评分

笨肉包的游戏讨论群932812135 (实时更新) 喜欢的话欢迎加入~
目前的坑
??? #像素风OC游戏 准备中 短篇-约5小时
花城梦之心 #像素风OC游戏 系统开发+素材绘制中
【不可思议的迷宫】幽灵契约外传:歌莉娅 v0.4 游戏文件已更新
同时更新中~ (沉迷摸鱼中~更新速度较慢请见谅w)
这是属于笨肉包一个人的旅行~(这只肉包又在摸鱼!
旅途的最终目标~ ???(保密~
回复 2 0

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部