加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 a111a 于 2013-8-13 00:07 编辑
下面这个是战斗时候显示怪物的脚本
由于这个脚本是显示怪物的我想改成显示角色的呢
怎么把他改成战斗显示角色名字的呢??
我知道原始脚本在战斗时候会显示名字
但是我想要把这个脚本改成角色的效果
还有使用了以后怎么改给吧名字的位置给定位起来??
class Spriteset_Battle #-------------------------------------------------------------------------- # ● 初始化变量 #-------------------------------------------------------------------------- def initialize # 生成显示端口 @viewport1 = Viewport.new(0, 0, 640, 320) @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 @enemy_names = [] for enemy in $game_troop.enemies @enemy_names.push(Sprite.new(@viewport1)) @enemy_names[-1].bitmap = Bitmap.new(128,32) @enemy_names[-1].bitmap.font.color = Color.new(125,0,125,255) @enemy_names[-1].bitmap.draw_text(0,0,128,32,enemy.name) @enemy_names[-1].x = enemy.screen_x - 20 @enemy_names[-1].y = enemy.screen_y - 30 @enemy_names[-1].z = 999 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 hide_name(i) @enemy_names[i].opacity = 0 if i != nil end def appear_name(i) #貌似翻了应该是name appear @enemy_names[i].opacity = 255 if i != nil end end class Game_Enemy attr_reader :member_index end class Scene_Battle alias u update_phase4_step3 def update_phase4_step3 if @active_battler.is_a?(Game_Enemy) @spriteset.hide_name(@active_battler.member_index) end u end alias u4 update_phase4_step4 def update_phase4_step4 for i in @target_battlers if i.is_a?(Game_Enemy) @spriteset.hide_name(i.member_index) end end u4 end alias up update def update if @wait_count == 1 @spriteset.appear_name(@active_battler.member_index) if @active_battler.is_a?(Game_Enemy) for i in @target_battlers @spriteset.appear_name(i.member_index) if i.is_a?(Game_Enemy) end end up end end
class Spriteset_Battle
#--------------------------------------------------------------------------
# ● 初始化变量
#--------------------------------------------------------------------------
def initialize
# 生成显示端口
@viewport1 = Viewport.new(0, 0, 640, 320)
@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
@enemy_names = []
for enemy in $game_troop.enemies
@enemy_names.push(Sprite.new(@viewport1))
@enemy_names[-1].bitmap = Bitmap.new(128,32)
@enemy_names[-1].bitmap.font.color = Color.new(125,0,125,255)
@enemy_names[-1].bitmap.draw_text(0,0,128,32,enemy.name)
@enemy_names[-1].x = enemy.screen_x - 20
@enemy_names[-1].y = enemy.screen_y - 30
@enemy_names[-1].z = 999
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 hide_name(i)
@enemy_names[i].opacity = 0 if i != nil
end
def appear_name(i) #貌似翻了应该是name appear
@enemy_names[i].opacity = 255 if i != nil
end
end
class Game_Enemy
attr_reader :member_index
end
class Scene_Battle
alias u update_phase4_step3
def update_phase4_step3
if @active_battler.is_a?(Game_Enemy)
@spriteset.hide_name(@active_battler.member_index)
end
u
end
alias u4 update_phase4_step4
def update_phase4_step4
for i in @target_battlers
if i.is_a?(Game_Enemy)
@spriteset.hide_name(i.member_index)
end
end
u4
end
alias up update
def update
if @wait_count == 1
@spriteset.appear_name(@active_battler.member_index) if @active_battler.is_a?(Game_Enemy)
for i in @target_battlers
@spriteset.appear_name(i.member_index) if i.is_a?(Game_Enemy)
end
end
up
end
end
|