Project1
标题:
怎么获取角色当前HP?
[打印本页]
作者:
缺牙de兔子
时间:
2009-1-21 22:57
标题:
怎么获取角色当前HP?
class Arpg_Actor
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_accessor :Actor_id # 角色ID
attr_accessor :Actor_action # 角色动作 0:什么都不做 1:移动 2:攻击 3:跳跃 4:中击 5:吟唱 6:死亡
attr_accessor :Actor_look # 角色的面向
attr_accessor :Actor_MapId # 角色所在地图
attr_accessor :Actors_x # 角色的x坐标
attr_accessor :Actors_y # 角色的y坐标
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
@Actor_id = $data_system.party_members[1]
@Actor_action=0
@Actor_look=8
@Actor_MapId=1
@Actors_x=0
@Actors_y=0
end
def Actor_message
@actor_ms=Window_Selectable.new(0,0,0,0)
@actor_ms.update
@devil = Sprite.new
@devil.x = 0
@devil.y = 310
@devil.bitmap = RPG::Cache.picture("状态栏")
@
[email protected]
message_refresh
end
def message_refresh
@devil1 = Sprite.new
@devil1.x = -30
@devil1.y = 380
@devil1.bitmap = Bitmap.new("Graphics/Battlers/"+$game_party.actors[@Actor_id-2].battler_name.to_s)
@actor_ms.windowskin.draw_text(1, 30, 120, 32,$game_party.actors[@Actor_id-2].name, 0)
@actor_ms.windowskin.draw_text(90, 120, 120, 32,"HP:", 0)
@actor_ms.windowskin.draw_text(90, 140, 120, 32,"SP:", 0)
Graphics.update
end
end
复制代码
我调用message_refresh时
@actor_ms.contents = RPG::Cache.battler($game_party.actors[@Actor_id-2].battler_name.to_s,0)这断脚本没起作用
我要在@actor_ms里面追加另一张图片要怎么写?
本来是想显示状态栏后再显示角色战斗图的
作者:
ONEWateR
时间:
2009-1-21 23:41
@actor_ms2 = xx {/fd}
作者:
缺牙de兔子
时间:
2009-1-22 00:16
不对--
我是想在不创建对象的情况下追加一个图片上去
这个问题可能没办法解决--
现在换另一个问题
#--------------------------------------------------------------------------
# ● 获得状态栏信息
#--------------------------------------------------------------------------
def message_refresh
@b = Sprite.new
@b.x = -30
@b.y = 380
@b.bitmap = Bitmap.new("Graphics/Battlers/"+$game_actors[@Actor_id].battler_name.to_s)
@actor_ms.windowskin.draw_text(1, 30, 120, 32,$game_actors[@Actor_id].name, 0)
@actor_ms.windowskin.draw_text(90, 120, 120, 32,"HP:", 0)
@actor_ms.windowskin.draw_text(90, 140, 120, 32,"SP:", 0)
@actor_ms.windowskin.draw_text(122, 120, 120, 32,getHP.to_s, 0)
Graphics.update
end
#--------------------------------------------------------------------------
# ● 获得角色HP
#--------------------------------------------------------------------------
def getHP
return $game_actors[@Actor_id].base_maxhp
end
复制代码
如何获得角色当前的HP
并不是maxhp
作者:
缺牙de兔子
时间:
2009-1-22 04:38
找了半天--
我还以为$game_actors没有hp这个属性呢
我的状态显示就快完成了
角色当前HP $game_actors[@Actor_id].hp
角色maxHP $game_actors[@Actor_id].maxhp
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1