Project1
标题:
灵异的找不到文件
[打印本页]
作者:
hys111111
时间:
2012-5-26 17:22
标题:
灵异的找不到文件
本帖最后由 hys111111 于 2012-5-26 17:32 编辑
求助一下吧……
这是脚本(后面有些错误请无视)
#==============================================================================
# ■ Scene_CardBattle
#------------------------------------------------------------------------------
# 处理卡片战斗画面的类。
#==============================================================================
class Scene_CardBattle
#--------------------------------------------------------------------------
# ● 初始化对像
# menu_index : 命令光标的初期位置
# battle_bgm : 战斗BGM
# background : 战斗背景图片
# enemy_id : 敌人编号
#--------------------------------------------------------------------------
def initialize(enemy_id,background = Bitmap.new("") ,battle_bgm = Audio.bgm_play("Audio/BGM/Boss_07", 100, 100))
# 生成对象
@battle_bgm = battle_bgm
@background = background
@enemy_id = enemy_id
end
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
# 播放BGM
@battle_bgm
# 生成背景位置
@background.x = 0
@background.y = 0
@background.z = 520
# 生成角色状态
@actor = $game_party.actors[0]
@actor_max = @actor.maxhp
@actor_str = @actor.str
@actor_dex = @actor.dex
@actor_int = @actor.int
@actor_agi = @actor.agi
@actor_eva = @actor.eva
@actor_message = Window_CardMessage.new(@actor,@actor_max,@actor_str,@actor_dex,@actor_int,@actor_agi,@actor_eva,0)
# 生成敌人状态
@enemy = $data_enemies[@enemy_id]
@enemy_max = @enemy.maxhp
@enemy_str = @enemy.str
@enemy_dex = @enemy.dex
@enemy_int = @enemy.int
@enemy_agi = @enemy.agi
@enemy_eva = @enemy.eva
@enemy_message = Window_CardMessage.new(@enemy,@enemy_max,@enemy_str,@enemy_dex,@enemy_int,@enemy_agi,@enemy_eva,0)
# 生成角色战斗图
@actor_battle = Bitmap.new("Graphics/Battlers" + @actor.battler_name)
@actor_battle.x = 336
@actor_battle.y = 32 - @actor_battle.height
@actor_battle.z = 530
# 生成敌人战斗图
@enemy_battle = Bitmap.new("Graphics/Battlers" + @enemy.battler_name)
@enemy_battle.x = 608 - @enemy_battle.width
@enemy_battle.y = 448 - @enemy_battle.height
@enemy_battle.z = 530
# 生成命令窗口
s1 = "出牌"
s2 = "扔牌"
s3 = "结束回合"
@command_window = Window_Command.new(160, [s1, s2, s3])
@command_window.index = 0
@command_window.back_opacity = 160
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面切换的话就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
# 释放窗口
@background.dispose
@actor_message.dispose
@enemy_message.dispose
@actor_battle.dispose
@enemy_battle.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
end
end
复制代码
我使用$scene = Scene_CardBattle.new(1)之后,
进入战斗画面。
结果,发现灵异的找不到文件(一大堆不明意义的字符)里面还带了一个def的名称……(BGM播放正常)
null15.jpg
(3.51 KB, 下载次数: 7)
下载附件
保存到相册
2012-5-26 17:16 上传
后来我加了容错脚本,看看倒出的log_bitmap是什么。
结果里面是空的……
这样子调用的话,BGM播放是正常的,但找不到文件却很灵异,求解。 dsu_plus_rewardpost_czw
作者:
Wind2010
时间:
2012-5-26 18:02
本帖最后由 Wind2010 于 2012-5-26 18:37 编辑
#==============================================================================
# ■ Scene_CardBattle
#------------------------------------------------------------------------------
# 处理卡片战斗画面的类。
#==============================================================================
class Scene_CardBattle
#--------------------------------------------------------------------------
# ● 初始化对像
# menu_index : 命令光标的初期位置
# battle_bgm : 战斗BGM
# background : 战斗背景图片
# enemy_id : 敌人编号
#--------------------------------------------------------------------------
def initialize(enemy_id,background=Bitmap.new("") ,battle_bgm = RPG::AudioFile.new("Audio/BGM/Boss_07", 100, 100))
# 生成对象
@battle_bgm = battle_bgm
@background = background
@enemy_id = enemy_id
end
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
# 播放BGM
Audio.bgm_play(@battle_bgm)
# 生成背景位置
@background.x = 0
@background.y = 0
@background.z = 520
# 生成角色状态
@actor = $game_party.actors[0]
@actor_max = @actor.maxhp
@actor_str = @actor.str
@actor_dex = @actor.dex
@actor_int = @actor.int
@actor_agi = @actor.agi
@actor_eva = @actor.eva
@actor_message = Window_CardMessage.new(@actor,@actor_max,@actor_str,@actor_dex,@actor_int,@actor_agi,@actor_eva,0)
# 生成敌人状态
@enemy = $data_enemies[@enemy_id]
@enemy_max = @enemy.maxhp
@enemy_str = @enemy.str
@enemy_dex = @enemy.dex
@enemy_int = @enemy.int
@enemy_agi = @enemy.agi
@enemy_eva = @enemy.eva
@enemy_message = Window_CardMessage.new(@enemy,@enemy_max,@enemy_str,@enemy_dex,@enemy_int,@enemy_agi,@enemy_eva,0)
# 生成角色战斗图
@actor_battle = Bitmap.new("Graphics/Battlers" + @actor.battler_name)
@actor_battle.x = 336
@actor_battle.y = 32 - @actor_battle.height
@actor_battle.z = 530
# 生成敌人战斗图
@enemy_battle = Bitmap.new("Graphics/Battlers" + @enemy.battler_name)
@enemy_battle.x = 608 - @enemy_battle.width
@enemy_battle.y = 448 - @enemy_battle.height
@enemy_battle.z = 530
# 生成命令窗口
s1 = "出牌"
s2 = "扔牌"
s3 = "结束回合"
@command_window = Window_Command.new(160, [s1, s2, s3])
@command_window.index = 0
@command_window.back_opacity = 160
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面切换的话就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
# 释放窗口
@background.dispose
@actor_message.dispose
@enemy_message.dispose
@actor_battle.dispose
@enemy_battle.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
end
end
复制代码
试试这样有没有问题
作者:
hys111111
时间:
2012-5-26 18:45
本帖最后由 hys111111 于 2012-5-26 19:33 编辑
Wind2010 发表于 2012-5-26 18:02
试试这样有没有问题
好像不关Audio.bgm_play(@battle_bgm)的事吧……
直接@battle_bgm播放正常……
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1