赞 | 0 |
VIP | 1 |
好人卡 | 28 |
积分 | 10 |
经验 | 59980 |
最后登录 | 2024-10-19 |
在线时间 | 1685 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 951
- 在线时间
- 1685 小时
- 注册时间
- 2009-7-25
- 帖子
- 534
|
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- #==============================================================================
- # ■ 战斗时自动更改状态栏大小和命令窗口位置
- #
- # 简单战斗系统,根据队员人数自动更改状态窗口大小,自动调整命令窗口位置;需
- # 要去站上下载一张640 * 480的战斗背景图,导入到Graphics/Battlebacks文件夹中,再
- # 在数据库的[图块]设置。
- #==============================================================================
- #==============================================================================
- # ■ Game_Actor
- #------------------------------------------------------------------------------
- # 处理角色的类。本类在 Game_Actors 类 ($game_actors)
- # 的内部使用、Game_Party 类请参考 ($game_party) 。
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # ● 取得战斗画面的 X 坐标
- #--------------------------------------------------------------------------
- def screen_x
- # 返回计算后的队伍 X 坐标的排列顺序
- case $game_party.actors.size
- when 0
- return 0
- when 1
- return 320
- when 2
- case self.index
- when 0
- return 240
- when 1
- return 400
- end
- when 3
- case self.index
- when 0
- return 160
- when 1
- return 320
- when 2
- return 480
- end
- when 4
- case self.index
- when 0
- return 80
- when 1
- return 240
- when 2
- return 400
- when 3
- return 560
- end
- end
- end
- end
- #------------------------------------------------------------------------------
- # 显示战斗画面同伴状态的窗口。
- #==============================================================================
- class Window_BattleStatus < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- case $game_party.actors.size
- when 1
- super(240, 320, 160, 160)
- when 2
- super(160, 320, 320, 160)
- when 3
- super(80, 320, 480, 160)
- when 4
- super(0, 320, 640, 160)
- end
- self.contents = Bitmap.new(width - 32, height - 32)
- @level_up_flags = [false, false, false, false]
- refresh
- end
- end
- #==============================================================================
- # ■ Spriteset_Battle
- #------------------------------------------------------------------------------
- # 处理战斗画面的活动块的类。本类在 Scene_Battle 类
- # 的内部使用。
- #==============================================================================
- class Spriteset_Battle
- #--------------------------------------------------------------------------
- # ● 初始化变量
- #--------------------------------------------------------------------------
- def initialize
- # 生成显示端口
- @viewport1 = Viewport.new(0, 0, 640, 480)
- @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
- # 生成敌人活动块
- @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 update
- # 刷新角色的活动块 (对应角色的替换)
- @actor_sprites[0].battler = $game_party.actors[0]
- @actor_sprites[1].battler = $game_party.actors[1]
- @actor_sprites[2].battler = $game_party.actors[2]
- @actor_sprites[3].battler = $game_party.actors[3]
- # 战斗背景的文件名与现在情况有差异的情况下
- if @battleback_name != $game_temp.battleback_name
- @battleback_name = $game_temp.battleback_name
- if @battleback_sprite.bitmap != nil
- @battleback_sprite.bitmap.dispose
- end
- @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
- @battleback_sprite.src_rect.set(0, 0, 640, 480)
- end
- # 刷新战斗者的活动块
- for sprite in @enemy_sprites + @actor_sprites
- sprite.update
- end
- # 刷新天气图形
- @weather.type = $game_screen.weather_type
- @weather.max = $game_screen.weather_max
- @weather.update
- # 刷新图片活动块
- for sprite in @picture_sprites
- sprite.update
- end
- # 刷新计时器活动块
- @timer_sprite.update
- # 设置画面的色调与震动位置
- @viewport1.tone = $game_screen.tone
- @viewport1.ox = $game_screen.shake
- # 设置画面的闪烁色
- @viewport4.color = $game_screen.flash_color
- # 刷新显示端口
- @viewport1.update
- @viewport2.update
- @viewport4.update
- end
- end
- #==============================================================================
- # ■ Scene_Battle (分割定义 1)
- #------------------------------------------------------------------------------
- # 处理战斗画面的类。
- #==============================================================================
- 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
- # 生成活动块
- @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
- 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
- #--------------------------------------------------------------------------
- # ● 设置角色指令窗口
- #--------------------------------------------------------------------------
- def phase3_setup_command_window
- # 同伴指令窗口无效化
- @party_command_window.active = false
- @party_command_window.visible = false
- # 角色指令窗口无效化
- @actor_command_window.active = true
- @actor_command_window.visible = true
- # 设置角色指令窗口的位置
- case $game_party.actors.size
- when 1
- @actor_command_window.x = @actor_index * 160 + 240
- when 2
- @actor_command_window.x = @actor_index * 160 + 160
- when 3
- @actor_command_window.x = @actor_index * 160 + 80
- when 4
- @actor_command_window.x = @actor_index * 160
- end
- # 设置索引为 0
- @actor_command_window.index = 0
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
复制代码 |
评分
-
查看全部评分
|