Project1
标题:
请教一个关于血条
[打印本页]
作者:
elpplp
时间:
2009-11-10 13:58
提示:
作者被禁止或删除 内容自动屏蔽
作者:
夏季冰川
时间:
2009-11-10 14:07
去框:
Spriteset_Battle里所有的320改成480,然后再换一张640*480的图片.
敌人血条:
在脚本里改改坐标就好.
我方血条:
LZ上传下工程吧,看我能不能写一个.
作者:
elpplp
时间:
2009-11-10 14:32
提示:
作者被禁止或删除 内容自动屏蔽
作者:
夏季冰川
时间:
2009-11-10 14:53
本帖最后由 夏季冰川 于 2009-11-10 14:55 编辑
你把横板战斗脚本放到最后一个。
关于我方血条坐标在这段:
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@item_max = $game_party.actors.size
self.contents = Bitmap.new(width - 32, self.row_max * 116 - 16)
for i in 0...$game_party.actors.size
x = 64
y = i * 116
actor = $game_party.actors[i]
draw_actor_graphic(actor, x - 40, y + 80)
draw_actor_name(actor, x, y)
draw_actor_class(actor, x + 144, y)
draw_actor_level(actor, x, y + 32)
draw_actor_state(actor, x + 90, y + 32)
draw_actor_exp(actor, x, y + 64)
draw_actor_hp(actor, x + 236, y + 32)
draw_actor_sp(actor, x + 236, y + 64)
end
end
复制代码
敌人血条坐标在这里:
def refresh
self.contents.clear
self.contents.font.color = system_color
# self.contents.font.size = 18
# self.contents.draw_text(0, 32, 24, 32, "HP")
# self.contents.draw_text(0, 64, 24, 32, "MP")
@item_max = $game_party.actors.size
# self.contents.font.size = 20
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
actor_x = i * SPRITES_BATTLER + 4
# draw_actor_name(actor, actor_x, 0)
# draw_actor_hp(actor, actor_x, 32, 120)
# draw_actor_sp(actor, actor_x, 64, 120)
if @level_up_flags[i]
self.contents.font.color = normal_color
self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
else
#draw_actor_state(actor, actor_x, 96)
end
end
end
end
复制代码
但是没工程我无法调试。
作者:
elpplp
时间:
2009-11-10 15:13
提示:
作者被禁止或删除 内容自动屏蔽
作者:
夏季冰川
时间:
2009-11-10 15:17
早就说要发上来了,再说我在LSS给你的是坐标的位置,你要改才有用啊。
作者:
elpplp
时间:
2009-11-10 15:18
提示:
作者被禁止或删除 内容自动屏蔽
作者:
elpplp
时间:
2009-11-10 15:23
提示:
作者被禁止或删除 内容自动屏蔽
作者:
夏季冰川
时间:
2009-11-10 15:53
我这上传速度就像渣一样,算了,我把脚本贴出来,坐标只能你自己调了。
首先,给战斗背景换张大图片(640*480)。
怪物血量显示41-42行替换成:
x = @battler.screen_x - width / 2
y = @battler.screen_y - height + PLAN_HPSP_DRAW::DRAW_Y
复制代码
然后以下脚本插入main之前,放到最后:
# ————————————————————————————————————
# 本脚本来自http://rpg.blue/web/,转载请保留此信息
# ————————————————————————————————————
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
# 游戏中全部窗口的超级类。
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● 描绘 HP
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# width : 描画目标的宽
#--------------------------------------------------------------------------
def draw_actor_hp1(actor, x, y, width = 72)
# 描绘字符串 "HP"
self.contents.font.color = system_color
self.contents.draw_text(x, y, 24, 24, $data_system.words.hp)
# 计算描绘 MaxHP 所需的空间
if width - 24 >= 32
hp_x = x + 32# + width - 24
end
# 描绘 HP
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(hp_x, y, 32, 24, actor.hp.to_s, 2)
end
#--------------------------------------------------------------------------
# ● 描绘 SP
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# width : 描画目标的宽
#--------------------------------------------------------------------------
def draw_actor_sp1(actor, x, y, width = 72)
# 描绘字符串 "SP"
self.contents.font.color = system_color
self.contents.draw_text(x, y, 24, 24, $data_system.words.sp)
# 计算描绘 MaxSP 所需的空间
if width - 24 >= 32
sp_x = x + 32# + width - 24
end
# 描绘 SP
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(sp_x, y, 32, 24, actor.sp.to_s, 2)
end
end
#==============================================================================
# ■ Window_BattleStatus
#------------------------------------------------------------------------------
# 显示战斗画面同伴状态的窗口。
#==============================================================================
class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
#$data_system_level_up_me = "Audio/ME/升级音乐"
def initialize
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 10, height - 32)
self.opacity = 0
@level_up_flags = [false, false, false, false]
refresh
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
super
end
#--------------------------------------------------------------------------
# ● 设置升级标志
# actor_index : 角色索引
#--------------------------------------------------------------------------
def level_up(actor_index)
@level_up_flags[actor_index] = true
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
case i
when 0
x = 500
y = 100
when 1
x = 500
y = 140
when 2
x = 500
y = 180
when 3
x = 500
y = 220
when 4
x = 500
y = 260
when 5
x = 500
y = 300
when 6
x = 500
y = 340
when 7
x = 500
y = 380
when 8
x = 500
y = 420
when 9
x = 500
y = 460
end
if @level_up_flags[i]
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 80, 24, "LEVEL UP!")
Audio.me_stop
# Audio.me_play($data_system_level_up_me)
else
draw_actor_hp1(actor, x-15, y-15, 80)
draw_actor_sp1(actor, x-15, y+5, 80)
end
end
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
super
end
end
#==============================================================================
# ■ Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
alias xrxs_bp2_refresh refresh
def refresh
xrxs_bp2_refresh
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
case i
when 0
x = 500
y = 100
when 1
x = 500
y = 140
when 2
x = 500
y = 180
when 3
x = 500
y = 220
when 4
x = 500
y = 260
when 5
x = 500
y = 300
when 6
x = 500
y = 340
when 7
x = 500
y = 380
when 8
x = 500
y = 420
when 9
x = 500
y = 460
end
draw_actor_hp_meter(actor, x, y, 50)
draw_actor_sp_meter(actor, x, y + 8, 50)
end
end
end
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● HP描画
#--------------------------------------------------------------------------
def draw_actor_hp_meter(actor, x, y, width = 156, type = 0)
if type == 1 and actor.hp == 0
return
end
self.contents.font.color = system_color
self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 25))
w = width * actor.hp / actor.maxhp
self.contents.fill_rect(x, y+28, w,1, Color.new(255, 96, 96, 255))
self.contents.fill_rect(x, y+29, w,1, Color.new(255, 0, 0, 255))
self.contents.fill_rect(x, y+30, w,1, Color.new(128, 0, 0, 255))
self.contents.fill_rect(x, y+31, w,1, Color.new(0, 0, 0, 255))
end
#--------------------------------------------------------------------------
# ● SP描画
#--------------------------------------------------------------------------
def draw_actor_sp_meter(actor, x, y, width = 156, type = 0)
if type == 1 and actor.hp == 0
return
end
self.contents.font.color = system_color
self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 255))
w = width * actor.sp / actor.maxsp
self.contents.fill_rect(x, y+28, w,1, Color.new(128, 255, 255, 255))
self.contents.fill_rect(x, y+29, w,1, Color.new(0, 255, 255, 255))
self.contents.fill_rect(x, y+30, w,1, Color.new(0, 192, 192, 255))
self.contents.fill_rect(x, y+31, w,1, Color.new(0, 128, 128, 255))
end
end
复制代码
作者:
elpplp
时间:
2009-11-10 15:54
提示:
作者被禁止或删除 内容自动屏蔽
作者:
elpplp
时间:
2009-11-10 16:11
提示:
作者被禁止或删除 内容自动屏蔽
作者:
elpplp
时间:
2009-11-10 16:11
提示:
作者被禁止或删除 内容自动屏蔽
作者:
elpplp
时间:
2009-11-10 20:17
提示:
作者被禁止或删除 内容自动屏蔽
作者:
夏季冰川
时间:
2009-11-11 02:11
本帖最后由 夏季冰川 于 2009-11-11 13:15 编辑
89-125行:文字坐标(就是那个HP,SP文字的位置)
164-194行:血条坐标
那个问题可以解决。
最简单的办法就是用指令化图标:
#==========================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==========================================================================
module Momo_IconCommand
# 图标名称设定
ATTACK_ICON_NAME = "1-攻击" # 攻撃
SKILL_ICON_NAME = "1-法术" # 特技
GUARD_ICON_NAME = "1-防御" # 防御
ITEM_ICON_NAME = "1-道具" # 物品
# X坐标修正
X_PLUS = 60
# Y坐标修正
Y_PLUS = -60
# 选择时图标的动作
# 0:静止 1:放大
SELECT_TYPE = 1
# 闪烁时光芒的颜色
FLASH_COLOR = Color.new(255, 255, 255, 128)
# 闪烁时间
FLASH_DURATION = 10
# 闪烁间隔
FLASH_INTERVAL = 20
# 是否写出文字的名称
COM_NAME_DROW = true
# 文字名称是否移动
COM_NAME_MOVE = true
# 文字内容
ATTACK_NAME = "攻击" # 攻击
SKILL_NAME = "法术" # 特技
GUARD_NAME = "防御" # 防御
ITEM_NAME = "道具" # 物品
# 文字颜色
COM_NAME_COLOR = Color.new(255, 255, 255, 255)
# 文字坐标修正
COM_NAME_X_PLUS = 0
COM_NAME_Y_PLUS = 0
end
class Window_CommandIcon < Window_Selectable
attr_accessor :last_index
#------------------------------------------------------------------------
# ● オブジェクト初期化
#------------------------------------------------------------------------
def initialize(x, y, commands)
super(x, y, 32, 32)
# ウィンドウスキンに空文字列を指定してウィンドウを描画しないようにする
self.windowskin = RPG::Cache.windowskin("")
@item_max = commands.size
@commands = commands
@column_max = 1
@index = 0
@last_index = nil
@name_sprite = nil
@sprite = []
refresh
end
def dispose
super
for sprite in @sprite
sprite.dispose unless sprite.nil?
end
@name_sprite.dispose unless @name_sprite.nil?
end
#------------------------------------------------------------------------
# ● リフレッシュ
#------------------------------------------------------------------------
def refresh
@name_sprite.dispose unless @name_sprite.nil?
for sprite in @sprite
sprite.dispose unless sprite.nil?
end
@name_sprite = nil
draw_com_name if Momo_IconCommand::COM_NAME_DROW
@sprite = []
for i in 0...@item_max
draw_item(i)
end
end
#------------------------------------------------------------------------
# ● 項目の描画
#------------------------------------------------------------------------
def draw_item(index)
@sprite[index] = Sprite_Icon.new(nil, @commands[index])
@sprite[index].z = self.z + 1
end
def draw_com_name
@name_sprite = Sprite_Comm_Name.new(nil, get_com_name)
end
# 更新
def update
super
icon_update
com_name_update if Momo_IconCommand::COM_NAME_DROW
if move_index?
@last_index = self.index
end
end
# アイコンの更新
def icon_update
for i in
[email protected]
@sprite[i].active = (self.index == i)
@sprite[i].x = self.x + 0
@sprite[i].y = self.y + 24*i
@sprite[i].z = (self.index == i) ? self.z + 2 : self.z + 1
@sprite[i].visible = self.visible
@sprite[i].update
end
end
# コマンドネームの更新
def com_name_update
if move_index?
@name_sprite.name = get_com_name
end
@name_sprite.x = self.x - 12 + Momo_IconCommand::COM_NAME_X_PLUS
@name_sprite.y = self.y - 40 + Momo_IconCommand::COM_NAME_Y_PLUS
@name_sprite.z = self.z + 1
@name_sprite.active = self.active
@name_sprite.visible = self.visible
@name_sprite.update
end
def get_com_name
make_name_set if @name_set.nil?
name = @name_set[self.index]
name = "" if name.nil?
return name
end
def make_name_set
@name_set = []
@name_set[0] = Momo_IconCommand::ATTACK_NAME
@name_set[1] = Momo_IconCommand::SKILL_NAME
@name_set[2] = Momo_IconCommand::GUARD_NAME
@name_set[3] = Momo_IconCommand::ITEM_NAME
end
def move_index?
return self.index != @last_index
end
def need_reset
@name_sprite.need_reset = true if Momo_IconCommand::COM_NAME_DROW
end
end
# アイコン用スプライト
class Sprite_Icon < Sprite
attr_accessor :active
attr_accessor :icon_name
#------------------------------------------------------------------------
# ● オブジェクト初期化
#------------------------------------------------------------------------
def initialize(viewport, icon_name)
super(viewport)
@icon_name = icon_name
@last_icon = @icon_name
@count = 0
self.bitmap = RPG::Cache.icon(@icon_name)
self.ox = self.bitmap.width / 2
self.oy = self.bitmap.height / 2
@active = false
end
#------------------------------------------------------------------------
# ● 解放
#------------------------------------------------------------------------
def dispose
if self.bitmap != nil
self.bitmap.dispose
end
super
end
#------------------------------------------------------------------------
# ● フレーム更新
#------------------------------------------------------------------------
def update
super
if @icon_name != @last_icon
@last_icon = @icon_name
self.bitmap = RPG::Cache.icon(@icon_name)
end
if @active
@count += 1
case Momo_IconCommand::SELECT_TYPE
when 0
icon_flash
when 1
icon_zoom
end
@count = 0 if @count == 20
else
icon_reset
end
end
def icon_flash
if @count % Momo_IconCommand::FLASH_INTERVAL == 0 or @count == 1
self.flash(Momo_IconCommand::FLASH_COLOR, Momo_IconCommand::FLASH_DURATION)
end
end
def icon_zoom
case @count
when 1..10
zoom = 1.0 + @count / 10.0
when 11..20
zoom = 2.0 - (@count - 10) / 10.0
end
self.zoom_x = zoom
self.zoom_y = zoom
end
def icon_reset
@count = 0
self.zoom_x = 1.0
self.zoom_y = 1.0
end
end
# コマンドネーム用スプライト
class Sprite_Comm_Name < Sprite
attr_accessor :active
attr_accessor :name
attr_accessor :need_reset
#------------------------------------------------------------------------
# ● オブジェクト初期化
#------------------------------------------------------------------------
def initialize(viewport, name)
super(viewport)
@name = name
@last_name = nil
@count = 0
@x_plus = 0
@opa_plus = 0
@need_reset = false
@active = false
self.bitmap = Bitmap.new(160, 32)
end
#------------------------------------------------------------------------
# ● 解放
#------------------------------------------------------------------------
def dispose
if self.bitmap != nil
self.bitmap.dispose
end
super
end
#------------------------------------------------------------------------
# ● フレーム更新
#------------------------------------------------------------------------
def update
super
if @active
if need_reset?
@need_reset = false
@last_name = @name
text_reset
end
move_text if Momo_IconCommand::COM_NAME_MOVE
end
end
def move_text
@count += 1
@x_plus = [@count * 8, 80].min
self.x = self.x - 80 + @x_plus
self.opacity = @count * 25
end
def text_reset
@count = 0
@x_plus = 0
self.bitmap.clear
self.bitmap.font.color = Momo_IconCommand::COM_NAME_COLOR
self.bitmap.draw_text(0, 0, 160, 32, @name)
end
def need_reset?
return (@name != @last_name or @need_reset)
end
end
class Scene_Battle
#------------------------------------------------------------------------
# ● プレバトルフェーズ開始
#------------------------------------------------------------------------
alias scene_battle_icon_command_start_phase1 start_phase1
def start_phase1
com1 = Momo_IconCommand::ATTACK_ICON_NAME
com2 = Momo_IconCommand::SKILL_ICON_NAME
com3 = Momo_IconCommand::GUARD_ICON_NAME
com4 = Momo_IconCommand::ITEM_ICON_NAME
@actor_command_window = Window_CommandIcon.new(0, 0, [com1, com2, com3, com4])
@actor_command_window.y = 160
@actor_command_window.back_opacity = 160
@actor_command_window.active = false
@actor_command_window.visible = false
@actor_command_window.update
scene_battle_icon_command_start_phase1
end
#------------------------------------------------------------------------
# ● アクターコマンドウィンドウのセットアップ
#------------------------------------------------------------------------
alias scene_battle_icon_command_phase3_setup_command_window phase3_setup_command_window
def phase3_setup_command_window
scene_battle_icon_command_phase3_setup_command_window
# アクターコマンドウィンドウの位置を設定
@actor_command_window.x = command_window_actor_x(@actor_index)
@actor_command_window.y = command_window_actor_y(@actor_index)
@actor_command_window.need_reset
end
def command_window_actor_x(index)
$game_party.actors[index].screen_x + Momo_IconCommand::X_PLUS
end
def command_window_actor_y(index)
$game_party.actors[index].screen_y + Momo_IconCommand::Y_PLUS
end
end
#==========================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==========================================================================
复制代码
如果要调整那些框框也可以,但现在我手上没RM,晚上再看看。
作者:
elpplp
时间:
2009-11-11 15:25
提示:
作者被禁止或删除 内容自动屏蔽
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1