Project1
标题:
战斗时血槽挡住了图片
[打印本页]
作者:
angelwangm
时间:
2009-2-10 05:25
标题:
战斗时血槽挡住了图片
战斗时需要用图片显示头像,但是这个人物血槽老是在头像前面显示
怎么改啊??
图片血槽如下
#图片血槽显示Ver 1.0(清爽版)
# by逐月
#描画HP槽
def HP (actor,x,y)
@bitmap3 = Bitmap.new("Graphics/Pictures/底")
@src_rect3 = Rect.new(0,0,@bitmap3.width, @bitmap3.height)
self.contents.blt(x,y, @bitmap3, @src_rect3)
#HP显示
@bitmap3 = Bitmap.new("Graphics/Pictures/hp")
w3 = @bitmap3.width * actor.hp/actor.maxhp
@src_rect3 = Rect.new(0,0,w3, @bitmap3.height)
self.contents.blt(x+4,y+2, @bitmap3, @src_rect3)
end
#描画SP槽
def SP (actor,x,y)
@bitmap1 = Bitmap.new("Graphics/Pictures/底")
@src_rect1 = Rect.new(0,0,@bitmap1.width, @bitmap1.height)
self.contents.blt(x,y, @bitmap1, @src_rect1)
#SP显示
@bitmap1 = Bitmap.new("Graphics/Pictures/sp")
w1 = @bitmap1.width * actor.sp/actor.maxsp
@src_rect1 = Rect.new(0,0,w1, @bitmap1.height)
self.contents.blt(x+4,y+2, @bitmap1, @src_rect1)
end
#==============================================================================
# 45度战斗坐标
# 来自 ikki
#==============================================================================
class Game_Actor < Game_Battler
#####################
#全体战斗者的X,Y篇幅
$X篇幅 = 150
$Y篇幅 = -20
#--------------------------------------------------------------------------
# ● 取得战斗画面的 X 坐标
#--------------------------------------------------------------------------
def screen_x
case self.index
when 0
return 350+$X篇幅
when 1
return 430+$X篇幅
when 2
return 510+$X篇幅
when 3
return 580+$X篇幅
else
return 600+$X篇幅
end
end
#--------------------------------------------------------------------------
# ● 取得战斗画面的 Y 坐标
#--------------------------------------------------------------------------
def screen_y
case self.index
when 0
return 430+$Y篇幅
when 1
return 400+$Y篇幅
when 2
return 360+$Y篇幅
when 3
return 320+$Y篇幅
else
return 1000+$Y篇幅
end
end
#--------------------------------------------------------------------------
# ● 取得战斗画面的 Z 坐标
#--------------------------------------------------------------------------
def screen_z
case self.index
when 0
return 10
when 1
return 9
when 2
return 8
when 3
return 7
else
return 0
end
end
end
#==============================================================================
# ■ Spriteset_Battle
#------------------------------------------------------------------------------
# 处理战斗画面的活动块的类。本类在 Scene_Battle 类
# 的内部使用。
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader :viewport1 # 敌人方的显示端口
attr_reader :viewport2 # 角色方的显示端口
#--------------------------------------------------------------------------
# ● 初始化变量
#--------------------------------------------------------------------------
def initialize
# 生成显示端口
@viewport1 = Viewport.new(0, 0, 640, 480)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport4 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 101
@viewport3.z = 200
@viewport4.z = 5000
# 生成战斗背景活动块
@battleback_sprite = Sprite.new(@viewport1)
# 生成敌人活动块
@enemy_sprites = []
for enemy in $game_troop.enemies.reverse
@enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
end
# 生成敌人活动块
@actor_sprites = []
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@actor_sprites.push(Sprite_Battler.new(@viewport2))
# 生成天候
@weather = RPG::Weather.new(@viewport1)
# 生成图片活动块
@picture_sprites = []
for i in 51..100
@picture_sprites.push(Sprite_Picture.new(@viewport3,
$game_screen.pictures[i]))
end
# 生成计时器块
@timer_sprite = Sprite_Timer.new
# 刷新画面
update
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
# 如果战斗背景位图存在的情况下就释放
if @battleback_sprite.bitmap != nil
@battleback_sprite.bitmap.dispose
end
# 释放战斗背景活动块
@battleback_sprite.dispose
# 释放敌人活动块、角色活动块
for sprite in @enemy_sprites + @actor_sprites
sprite.dispose
end
# 释放天候
@weather.dispose
# 释放图片活动块
for sprite in @picture_sprites
sprite.dispose
end
# 释放计时器活动块
@timer_sprite.dispose
# 释放显示端口
@viewport1.dispose
@viewport2.dispose
@viewport3.dispose
@viewport4.dispose
end
#--------------------------------------------------------------------------
# ● 显示效果中判定
#--------------------------------------------------------------------------
def effect?
# 如果是在显示效果中的话就返回 true
for sprite in @enemy_sprites + @actor_sprites
return true if sprite.effect?
end
return false
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 刷新角色的活动块 (对应角色的替换)
@actor_sprites[0].battler = $game_party.actors[0]
@actor_sprites[1].battler = $game_party.actors[1]
@actor_sprites[2].battler = $game_party.actors[2]
@actor_sprites[3].battler = $game_party.actors[3]
# 战斗背景的文件名与现在情况有差异的情况下
if @battleback_name != $game_temp.battleback_name
@battleback_name = $game_temp.battleback_name
if @battleback_sprite.bitmap != nil
@battleback_sprite.bitmap.dispose
end
@battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
@battleback_sprite.src_rect.set(0, 0, 640, 480)
end
# 刷新战斗者的活动块
for sprite in @enemy_sprites + @actor_sprites
sprite.update
end
# 刷新天气图形
@weather.type = $game_screen.weather_type
@weather.max = $game_screen.weather_max
@weather.update
# 刷新图片活动块
for sprite in @picture_sprites
sprite.update
end
# 刷新计时器活动块
@timer_sprite.update
# 设置画面的色调与震动位置
@viewport1.tone = $game_screen.tone
@viewport1.ox = $game_screen.shake
# 设置画面的闪烁色
@viewport4.color = $game_screen.flash_color
# 刷新显示端口
@viewport1.update
@viewport2.update
@viewport4.update
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 = 310
y = 390
when 1
x = 390
y = 340
when 2
x = 480
y = 300
when 3
x = 550
y = 270
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
end
end
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
super
# 主界面的不透明度下降
if $game_temp.battle_main_phase
self.contents_opacity -= 50 if self.contents_opacity > 1
else
self.contents_opacity += 50 if self.contents_opacity < 255
end
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 = 310
y = 390
when 1
x = 390
y = 340
when 2
x = 480
y = 300
when 3
x = 550
y = 270
end
###########################一切自改##############################
HP(actor, x-10, y)
SP(actor, x-10, y + 10)
#######################################一切自改###############
end
end
end
复制代码
[LINE]1,#dddddd[/LINE]
此贴于 2009-2-11 12:34:40 被版主darkten提醒,请楼主看到后对本贴做出回应。
[LINE]1,#dddddd[/LINE]
版务信息:本贴由楼主自主结贴~
作者:
玄月
时间:
2009-2-10 06:53
看到LZ的签名图很眼熟所以进来留个爪子。
因为脚本原因,战斗血条是压在战斗显示头像上面的。解决的方法除了改脚本之外最好还是新建一个窗口来显示头像。建议LZ参考一下我这个帖子
http://rpg.blue/viewthread.php?t ... D2%2D9+22%3A53%3A31
class Window_Battleface < Window_Base
#--------------------------------------------------------------------------
# ● 初始化目标
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
self.z = 199
复制代码
把这部分的z值改大一点就可以了
作者:
angelwangm
时间:
2009-2-10 17:29
楼上的方法可以解决头像的问题,可我是想在战斗中显示图片(不仅仅是头像)
血条还是在图片上面显示
那个。。。
话说我用的截图存档的脚本还是楼上提供的
冒昧的问一下,血条的Z值怎么改低一些?
作者:
angelwangm
时间:
2009-2-11 01:39
顶上去
作者:
玄月
时间:
2009-2-11 04:39
我说的很清楚了,请LZ举一反三 [LINE]1,#dddddd[/LINE]
系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
作者:
angelwangm
时间:
2009-2-11 20:45
我不是没有动脑子想 而是实在不知道怎么办
重新发一帖再问吧!
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1