| 赞 | 5 |
| VIP | |
| 好人卡 | |
| 积分 | 39 |
| 经验 | |
| 最后登录 | 2026-8-3 |
| 在线时间 | 1899 小时 |
- 梦石
- 0
- 星屑
- 3850
- 在线时间
- 1899 小时
- 注册时间
- 2010-6-19
- 回帖
- 917
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 黑米馒头 于 2024-5-5 20:24 编辑
游戏里用了2种显示图片的方法,第一种真移位显示图片太乱,有没办法改成第二种那样简化显示
真移位图片显示:
@number = (@number + 1) % BattlerName[@battler.name][@battler.startactive].size
self.bitmap = RPG::Cache.battler(BattlerName[@battler.name][@battler.startactive][@number], @battler_hue)
[pre lang="ruby" file="Scene_BattleName"]module Scene_BattleName
# 移动速度
Move_Duration = 40
BattlerName = {
"阿尔西斯" => {
"待" => ["阿尔西斯/待/1","阿尔西斯/待/2","阿尔西斯/待/3","阿尔西斯/待/4"],
"移" => ["阿尔西斯/移/1","阿尔西斯/移/2","阿尔西斯/移/3","阿尔西斯/移/4","阿尔西斯/移/5","阿尔西斯/移/6","阿尔西斯/移/7","阿尔西斯/移/8"],
"返" => ["阿尔西斯/返/1","阿尔西斯/返/2","阿尔西斯/返/3","阿尔西斯/返/4","阿尔西斯/返/5","阿尔西斯/返/6","阿尔西斯/返/7","阿尔西斯/返/8"]
},
}
end
class Scene_Battle
include Scene_BattleName
end
class Sprite_Battler
include Scene_BattleName
end[/pre]
简化图片显示
[fold]#==============================================================================
# ■ Window_Head
#------------------------------------------------------------------------------
# 处理宠物图像画面的类。
#==============================================================================
class Window_Head < Window_Base
def initialize(actor)
super(100, 42, 500, 390)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
self.z = 999
@bitmap_index = 0
@rect = Rect.new(0, 0, 1, 1)
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
actor = $baby_index
return if actor.nil? or Baby_Face[actor.name].nil?
if @id != actor.id or @face != actor.face
# 宠物图片类型设定
actor.face = "待" or "移" if actor.face.nil?
@id = actor.id
@face = actor.face
@bitmap_index = 0
str = Baby_Face[actor.name][actor.face]
@index = [*str.split("-")[0].to_i..str.split("-")[1].to_i]
end
filename = sprintf("%d", @index[@bitmap_index])
# 宠物图片显示格式
bitmap = Bitmap.new("Graphics/Battlers/#{actor.name}/敌/#{actor.face}/"+filename)
@bitmap_index += 1
if @bitmap_index >= @index.size
@bitmap_index = 0
# 宠物图片类型切换的时间
if rand(40) < 10
ar = Baby_Face[actor.name].keys
actor.face = ar[rand(ar.size)]
end
end
end
end
#==============================================================================
# ■ Scene_BattleName
#------------------------------------------------------------------------------
# 设置宠物图像画面的类。
#==============================================================================
module Scene_BattleName
Baby_Face = {
"阿尔西斯" => {"待" => "1-4","移" => "1-8","返" => "1-8"},
}
end
#==============================================================================
# ■ Window_Head
#------------------------------------------------------------------------------
# 处理宠物图像画面的类。
#==============================================================================
class Window_Head < Window_Base
include Scene_BattleName
end
[/fold] |
|