class Scene_Battle #-------------------------------------------------------------------------- # ● 主处理 #-------------------------------------------------------------------------- def main # 初始化战斗用的各种暂时数据 $game_temp.in_battle = true $game_temp.battle_turn = 0 $game_temp.battle_event_flags.clear $game_temp.battle_abort = false $game_temp.battle_main_phase = false $game_temp.battleback_name = $game_map.battleback_name $game_temp.forcing_battler = nil # 初始化战斗用事件解释器 $game_system.battle_interpreter.setup(nil, 0) # 准备队伍 @troop_id = $game_temp.battle_troop_id $game_troop.setup(@troop_id) # 生成角色命令窗口 s1 = $data_system.words.attack s2 = $data_system.words.skill s3 = $data_system.words.guard s4 = $data_system.words.item @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4]) @actor_command_window.y = 160 @actor_command_window.back_opacity = 160 @actor_command_window.active = false @actor_command_window.visible = false # 生成其它窗口 @party_command_window = Window_PartyCommand.new @help_window = Window_Help.new @help_window.back_opacity = 160 @help_window.visible = false @status_window = Window_BattleStatus.new @message_window = Window_Message.new # =============================================================== # 加头像 # =============================================================== @actor_face = [] for i in 0...$game_party.actors.size actor = $game_party.actors[i] @actor_face[i] = Sprite.new @actor_face[i].bitmap = Bitmap.new\ ("Graphics/face/"+actor.name.to_s+".png") @actor_face[i].x = i * 220 + 4 # 头像X坐标 @actor_face[i].y = 372 # 头像Y坐标 @actor_face[i].z = 999 # 头像Z 101在文字下 没特殊需要就别动了 end # 生成活动块 @spriteset = Spriteset_Battle.new # 初始化等待计数 @wait_count = 0 # 执行过渡 if $data_system.battle_transition == "" Graphics.transition(20) else Graphics.transition(40, "Graphics/Transitions/" + $data_system.battle_transition) end # 开始自由战斗回合 start_phase1 # 主循环 loop do # 刷新游戏画面 Graphics.update # 刷新输入信息 Input.update # 刷新画面 update # 如果画面切换的话就中断循环 if $scene != self break end end # 刷新地图 $game_map.refresh # 准备过渡 Graphics.freeze # 释放窗口 @actor_command_window.dispose @party_command_window.dispose @help_window.dispose @status_window.dispose @message_window.dispose #释放精灵数组 for i in @actor_face i.dispose end if @skill_window != nil @skill_window.dispose end if @item_window != nil @item_window.dispose end if @result_window != nil @result_window.dispose end # 释放活动块 @spriteset.dispose # 标题画面切换中的情况 if $scene.is_a?(Scene_Title) # 淡入淡出画面 Graphics.transition Graphics.freeze end # 战斗测试或者游戏结束以外的画面切换中的情况 if $BTEST and not $scene.is_a?(Scene_Gameover) $scene = nil end end end
23322332.jpg (27.47 KB, 下载次数: 6)
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |