Project1
标题:
[700分,1卡]改脚本~
[打印本页]
作者:
哈根达斯
时间:
2009-2-6 02:28
标题:
[700分,1卡]改脚本~
class Spriteset_Battle
#--------------------------------------------------------------------------
# ● 生成敌人活动块
#--------------------------------------------------------------------------
def create_enemies
@enemy_sprites = []
@enemy_hpbar_sprites = []
for enemy in $game_troop.members.reverse
@enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
@enemy_hpbar_sprites.push(Sprite_Hpbar.new(@viewport1, enemy))
end
end
#--------------------------------------------------------------------------
# ● 刷新敌人活动块
#--------------------------------------------------------------------------
def update_enemies
for sprite in @enemy_sprites + @enemy_hpbar_sprites
sprite.update
end
end
#--------------------------------------------------------------------------
# ● 释放敌人活动块
#--------------------------------------------------------------------------
def dispose_enemies
for sprite in @enemy_sprites + @enemy_hpbar_sprites
sprite.dispose
end
end
end
#==============================================================================
# ■ Sprite_Sprite_Hpbar
#------------------------------------------------------------------------------
# 血条显示
#==============================================================================
class Sprite_Hpbar < Sprite_Base
#--------------------------------------------------------------------------
# ● 定量
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_accessor :battler
#--------------------------------------------------------------------------
# ● 初始化对像
# viewport : 视口
# battler : 战斗者 (Game_Battler)
#--------------------------------------------------------------------------
def initialize(viewport, battler = nil)
super(viewport)
@battler = battler
@name = @battler.name
@hp = @battler.hp
self.bitmap = Bitmap.new(100,50)
# self.bitmap.fill_rect(0,0,100,50,Color.new(255,0,0,255))
self.bitmap.draw_text(0,10,100,20,@battler.name ,1)
draw_actor_hp_gauge(@battler, 0, 15, 50)
self.x = @battler.screen_x - 30
self.y = @battler.screen_y - self.bitmap.height / 2
# self.ox = self.bitmap.width
# self.oy = self.bitmap.height
self.z = @battler.screen_z + 5
end
#--------------------------------------------------------------------------
# ● 获取文字色
# n : 文字色编号 (0~31)
#--------------------------------------------------------------------------
def text_color(n)
windowskin = Cache.system("Window")
x = 64 + (n % 8) * 8
y = 96 + (n / 8) * 8
return windowskin.get_pixel(x, y)
end
#--------------------------------------------------------------------------
# ● HP矩形的描画
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# width : 宽
#--------------------------------------------------------------------------
def draw_actor_hp_gauge(actor, x, y, width = 120)
gw = width * @hp / actor.maxhp
gc1 = text_color(28)
gc2 = text_color(24)
self.bitmap.fill_rect(x, y + 24 - 8, width, 6, text_color(19))
self.bitmap.gradient_fill_rect(x, y + 24 - 8, gw, 6, gc1, gc2)
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
if self.bitmap != nil
self.bitmap.dispose
end
super
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
super
if @battler == nil
self.bitmap = nil
else
update_battler_bitmap
end
end
#--------------------------------------------------------------------------
# ● 刷新传送的位图数据
#--------------------------------------------------------------------------
def update_battler_bitmap
if @battler.dead? or @battler.hidden
self.opacity = 0
end
if
[email protected]
? and
[email protected]
and self.opacity == 0
self.opacity = 255
end
if @hp != @battler.hp or @name != @battler.name
@name = @battler.name
@hp = @battler.hp
self.bitmap.clear
self.bitmap.draw_text(0,10,100,20,@battler.name ,1)
draw_actor_hp_gauge(@battler, 0, 15, 50)
end
end
end
复制代码
这个是脚本,麻烦修改一下
一、血条在上名字在下
二、名字小一点
三、图片图条……
用
和
配合成图片血条
[LINE]1,#dddddd[/LINE]
版务信息:本贴由楼主自主结贴~
作者:
木葬枫
时间:
2009-2-6 02:31
class Spriteset_Battle
#--------------------------------------------------------------------------
# ● 生成敌人活动块
#--------------------------------------------------------------------------
def create_enemies
@enemy_sprites = []
@enemy_hpbar_sprites = []
for enemy in $game_troop.members.reverse
@enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
@enemy_hpbar_sprites.push(Sprite_Hpbar.new(@viewport1, enemy))
end
end
#--------------------------------------------------------------------------
# ● 刷新敌人活动块
#--------------------------------------------------------------------------
def update_enemies
for sprite in @enemy_sprites + @enemy_hpbar_sprites
sprite.update
end
end
#--------------------------------------------------------------------------
# ● 释放敌人活动块
#--------------------------------------------------------------------------
def dispose_enemies
for sprite in @enemy_sprites + @enemy_hpbar_sprites
sprite.dispose
end
end
end
#==============================================================================
# ■ Sprite_Sprite_Hpbar
#------------------------------------------------------------------------------
# 血条显示
#==============================================================================
class Sprite_Hpbar < Sprite_Base
#--------------------------------------------------------------------------
# ● 定量
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_accessor :battler
#--------------------------------------------------------------------------
# ● 初始化对像
# viewport : 视口
# battler : 战斗者 (Game_Battler)
#--------------------------------------------------------------------------
def initialize(viewport, battler = nil)
super(viewport)
@battler = battler
@name = @battler.name
@hp = @battler.hp
self.bitmap = Bitmap.new(100,50)
# self.bitmap.fill_rect(0,0,100,50,Color.new(255,0,0,255))
self.bitmap.draw_text(0,10,100,20,@battler.name ,1)
draw_actor_hp_gauge(@battler, 0, 15, 50)
self.x = @battler.screen_x - 30
self.y = @battler.screen_y - self.bitmap.height / 2
# self.ox = self.bitmap.width
# self.oy = self.bitmap.height
self.z = @battler.screen_z + 5
end
#--------------------------------------------------------------------------
# ● 获取文字色
# n : 文字色编号 (0~31)
#--------------------------------------------------------------------------
def text_color(n)
windowskin = Cache.system("Window")
x = 64 + (n % 8) * 8
y = 96 + (n / 8) * 8
return windowskin.get_pixel(x, y)
end
#--------------------------------------------------------------------------
# ● HP矩形的描画
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# width : 宽
#--------------------------------------------------------------------------
def draw_actor_hp_gauge(actor, x, y, width = 120)
gw = width * @hp / actor.maxhp
gc1 = text_color(28)
gc2 = text_color(24)
self.bitmap.fill_rect(x, y + 24 - 8, width, 6, text_color(19))
self.bitmap.gradient_fill_rect(x, y + 24 - 8, gw, 6, gc1, gc2)
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
if self.bitmap != nil
self.bitmap.dispose
end
super
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
super
if @battler == nil
self.bitmap = nil
else
update_battler_bitmap
end
end
#--------------------------------------------------------------------------
# ● 刷新传送的位图数据
#--------------------------------------------------------------------------
def update_battler_bitmap
if @battler.dead? or @battler.hidden
self.opacity = 0
end
if
[email protected]
? and
[email protected]
and self.opacity == 0
self.opacity = 255
end
if @hp != @battler.hp or @name != @battler.name
@name = @battler.name
@hp = @battler.hp
self.bitmap.clear
self.bitmap.draw_text(0,10,100,20,@battler.name ,1)
draw_actor_hp_gauge(@battler, 0, 15, 50)
end
end
end
复制代码
[LINE]1,#dddddd[/LINE]
系统信息:本贴获得楼主认可,66RPG感谢您的热情解答~
[LINE]1,#dddddd[/LINE]
系统信息:本贴获得楼主认可,66RPG感谢您的热情解答~
[LINE]1,#dddddd[/LINE]
系统信息:本贴获得楼主认可,66RPG感谢您的热情解答~
作者:
哈根达斯
时间:
2009-2-6 02:32
望楼上,好速度……
去笔记本试一下,稍后更精彩
[LINE]1,#dddddd[/LINE]
麻烦修改一下
一、血条在上名字在下
二、名字小一点
三、图片图条……
用
和
配合成图片血条
作者:
死亡之龙
时间:
2009-2-6 06:43
提示:
作者被禁止或删除 内容自动屏蔽
作者:
哈根达斯
时间:
2009-2-6 17:04
……自顶,怎么没有人- -b
作者:
水镜风生
时间:
2009-2-6 18:49
ENEMY_NAME_SIZE = 16 # 怪物名字大小
HP_X = 2 # HP的X坐标
HP_Y = 12 # HP的Y坐标
HP_BACKGROUND_COLOR = Color.new(0, 0, 0) # 血条背景颜色,三个0是黑色,三个255是白色
HP_BAR_NAME1 = "HPbar1" # 血条图片外面那个框框的图片名称
HP_BAR_NAME2 = "HPbar2" # 血条图片红色那部分的图片名称
# 上面两个的双引号不能去掉
class Spriteset_Battle
#--------------------------------------------------------------------------
# ● 生成敌人活动块
#--------------------------------------------------------------------------
def create_enemies
@enemy_sprites = []
@enemy_hpbar_sprites = []
for enemy in $game_troop.members.reverse
@enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
@enemy_hpbar_sprites.push(Sprite_Hpbar.new(@viewport1, enemy))
end
end
#--------------------------------------------------------------------------
# ● 刷新敌人活动块
#--------------------------------------------------------------------------
def update_enemies
for sprite in @enemy_sprites + @enemy_hpbar_sprites
sprite.update
end
end
#--------------------------------------------------------------------------
# ● 释放敌人活动块
#--------------------------------------------------------------------------
def dispose_enemies
for sprite in @enemy_sprites + @enemy_hpbar_sprites
sprite.dispose
end
end
end
#==============================================================================
# ■ Sprite_Sprite_Hpbar
#------------------------------------------------------------------------------
# 血条显示
#==============================================================================
class Sprite_Hpbar < Sprite_Base
#--------------------------------------------------------------------------
# ● 定量
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_accessor :battler
#--------------------------------------------------------------------------
# ● 初始化对像
# viewport : 视口
# battler : 战斗者 (Game_Battler)
#--------------------------------------------------------------------------
def initialize(viewport, battler = nil)
super(viewport)
@battler = battler
@name = @battler.name
@hp = @battler.hp
self.bitmap = Bitmap.new(100,50)
# self.bitmap.fill_rect(0,0,100,50,Color.new(255,0,0,255))
draw_battler_hp(HP_X, HP_Y, 50)
self.x = @battler.screen_x - 30
self.y = @battler.screen_y - self.bitmap.height / 2
# self.ox = self.bitmap.width
# self.oy = self.bitmap.height
self.z = @battler.screen_z + 5
end
#--------------------------------------------------------------------------
# ● 获取文字色
# n : 文字色编号 (0~31)
#--------------------------------------------------------------------------
def text_color(n)
windowskin = Cache.system("Window")
x = 64 + (n % 8) * 8
y = 96 + (n / 8) * 8
return windowskin.get_pixel(x, y)
end
#--------------------------------------------------------------------------
# ● HP矩形的描画
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# width : 宽
#--------------------------------------------------------------------------
def draw_actor_hp_gauge(x, y, width = 120)
bitmap = Cache.load_bitmap("Graphics/Pictures/", HP_BAR_NAME1)
rect = Rect.new(0, 0, 100, 50)
self.bitmap.blt(x, y, bitmap, rect)
bitmap = Cache.load_bitmap("Graphics/Pictures/", HP_BAR_NAME2)
self.bitmap.blt(x + 4, y + 2, bitmap, rect)
rect.width = bitmap.width - bitmap.width * @battler.hp / @battler.maxhp
rect.height = bitmap.height
rect.y = y + 2
rect.x = bitmap.width + 6 - rect.width
self.bitmap.fill_rect(rect, HP_BACKGROUND_COLOR)
end
#--------------------------------------------------------------------------
# ● 画HP
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# width : 宽
#--------------------------------------------------------------------------
def draw_battler_hp(x, y, width = 120)
self.bitmap.clear
self.bitmap.font.size = ENEMY_NAME_SIZE
self.bitmap.draw_text(x - 12, y + 6, 100,20, @battler.name ,1)
draw_actor_hp_gauge(x, y, width)
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
if self.bitmap != nil
self.bitmap.dispose
end
super
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
super
if @battler == nil
self.bitmap = nil
else
update_battler_bitmap
end
end
#--------------------------------------------------------------------------
# ● 刷新传送的位图数据
#--------------------------------------------------------------------------
def update_battler_bitmap
if @battler.dead? or @battler.hidden
self.opacity = 0
end
if
[email protected]
? and
[email protected]
and self.opacity == 0
self.opacity = 255
end
if @hp != @battler.hp or @name != @battler.name
draw_battler_hp(HP_X, HP_Y, 50)
end
end
end
复制代码
开头提供了些可变更的参数,都有详细说明……
PS:血条外面那个框未去底…… [LINE]1,#dddddd[/LINE]
系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
作者:
哈根达斯
时间:
2009-2-6 19:09
楼上的,么一个{/hx}
楼上的把脚本发布了吧,还能多赚几个vv
作者:
水镜风生
时间:
2009-2-6 19:21
以下引用
哈根达斯于2009-2-6 11:09:24
的发言:
楼上的,么一个
楼上的把脚本发布了吧,还能多赚几个vv
MS这类脚本已经有很多,懒得发了……
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1