设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2071|回复: 1

[已经解决] 如何把战斗窗口下的角色状态窗口改成这样?

[复制链接]
头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
17 小时
注册时间
2008-7-27
帖子
172
发表于 2011-2-21 21:49:19 | 显示全部楼层 |阅读模式
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽

Lv2.观梦者

梦石
0
星屑
790
在线时间
1666 小时
注册时间
2009-7-25
帖子
532

开拓者

发表于 2011-2-21 22:49:26 | 显示全部楼层
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================


  4. #==============================================================================
  5. # ■ 战斗时自动更改状态栏大小和命令窗口位置
  6. #
  7. #     简单战斗系统,根据队员人数自动更改状态窗口大小,自动调整命令窗口位置;需
  8. # 要去站上下载一张640 * 480的战斗背景图,导入到Graphics/Battlebacks文件夹中,再
  9. # 在数据库的[图块]设置。
  10. #==============================================================================


  11. #==============================================================================
  12. # ■ Game_Actor
  13. #------------------------------------------------------------------------------
  14. #  处理角色的类。本类在 Game_Actors 类 ($game_actors)
  15. # 的内部使用、Game_Party 类请参考 ($game_party) 。
  16. #==============================================================================

  17. class Game_Actor < Game_Battler
  18. #--------------------------------------------------------------------------
  19. # ● 取得战斗画面的 X 坐标
  20. #--------------------------------------------------------------------------
  21. def screen_x
  22.   # 返回计算后的队伍 X 坐标的排列顺序
  23.   case $game_party.actors.size
  24.   when 0
  25.     return 0
  26.   when 1
  27.     return 320
  28.   when 2
  29.     case self.index
  30.     when 0
  31.       return 240
  32.     when 1
  33.       return 400
  34.     end
  35.   when 3
  36.     case self.index
  37.     when 0
  38.       return 160
  39.     when 1
  40.       return 320
  41.     when 2
  42.       return 480
  43.     end
  44.   when 4
  45.     case self.index
  46.     when 0
  47.       return 80
  48.     when 1
  49.       return 240
  50.     when 2
  51.       return 400
  52.     when 3
  53.       return 560
  54.     end
  55.   end
  56. end
  57. end
  58. #------------------------------------------------------------------------------
  59. #  显示战斗画面同伴状态的窗口。
  60. #==============================================================================

  61. class Window_BattleStatus < Window_Base
  62. #--------------------------------------------------------------------------
  63. # ● 初始化对像
  64. #--------------------------------------------------------------------------
  65. def initialize
  66.   case $game_party.actors.size
  67.   when 1
  68.     super(240, 320, 160, 160)
  69.   when 2
  70.     super(160, 320, 320, 160)
  71.   when 3
  72.     super(80, 320, 480, 160)
  73.   when 4
  74.     super(0, 320, 640, 160)
  75.   end
  76.   self.contents = Bitmap.new(width - 32, height - 32)
  77.   @level_up_flags = [false, false, false, false]
  78.   refresh
  79. end
  80. end
  81. #==============================================================================
  82. # ■ Spriteset_Battle
  83. #------------------------------------------------------------------------------
  84. #  处理战斗画面的活动块的类。本类在 Scene_Battle 类
  85. # 的内部使用。
  86. #==============================================================================

  87. class Spriteset_Battle
  88. #--------------------------------------------------------------------------
  89. # ● 初始化变量
  90. #--------------------------------------------------------------------------
  91. def initialize
  92.   # 生成显示端口
  93.   @viewport1 = Viewport.new(0, 0, 640, 480)
  94.   @viewport2 = Viewport.new(0, 0, 640, 480)
  95.   @viewport3 = Viewport.new(0, 0, 640, 480)
  96.   @viewport4 = Viewport.new(0, 0, 640, 480)
  97.   @viewport2.z = 101
  98.   @viewport3.z = 200
  99.   @viewport4.z = 5000
  100.   # 生成战斗背景活动块
  101.   @battleback_sprite = Sprite.new(@viewport1)
  102.   # 生成敌人活动块
  103.   @enemy_sprites = []
  104.   for enemy in $game_troop.enemies.reverse
  105.     @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
  106.   end
  107.   # 生成敌人活动块
  108.   @actor_sprites = []
  109.   @actor_sprites.push(Sprite_Battler.new(@viewport2))
  110.   @actor_sprites.push(Sprite_Battler.new(@viewport2))
  111.   @actor_sprites.push(Sprite_Battler.new(@viewport2))
  112.   @actor_sprites.push(Sprite_Battler.new(@viewport2))
  113.   # 生成天候
  114.   @weather = RPG::Weather.new(@viewport1)
  115.   # 生成图片活动块
  116.   @picture_sprites = []
  117.   for i in 51..100
  118.     @picture_sprites.push(Sprite_Picture.new(@viewport3,
  119.     $game_screen.pictures[i]))
  120.   end
  121.   # 生成计时器块
  122.   @timer_sprite = Sprite_Timer.new
  123.   # 刷新画面
  124.   update
  125. end
  126. #--------------------------------------------------------------------------
  127. # ● 刷新画面
  128. #--------------------------------------------------------------------------
  129. def update
  130.   # 刷新角色的活动块 (对应角色的替换)
  131.   @actor_sprites[0].battler = $game_party.actors[0]
  132.   @actor_sprites[1].battler = $game_party.actors[1]
  133.   @actor_sprites[2].battler = $game_party.actors[2]
  134.   @actor_sprites[3].battler = $game_party.actors[3]
  135.   # 战斗背景的文件名与现在情况有差异的情况下
  136.   if @battleback_name != $game_temp.battleback_name
  137.     @battleback_name = $game_temp.battleback_name
  138.     if @battleback_sprite.bitmap != nil
  139.       @battleback_sprite.bitmap.dispose
  140.     end
  141.     @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
  142.     @battleback_sprite.src_rect.set(0, 0, 640, 480)
  143.   end
  144.   # 刷新战斗者的活动块
  145.   for sprite in @enemy_sprites + @actor_sprites
  146.     sprite.update
  147.   end
  148.   # 刷新天气图形
  149.   @weather.type = $game_screen.weather_type
  150.   @weather.max = $game_screen.weather_max
  151.   @weather.update
  152.   # 刷新图片活动块
  153.   for sprite in @picture_sprites
  154.     sprite.update
  155.   end
  156.   # 刷新计时器活动块
  157.   @timer_sprite.update
  158.   # 设置画面的色调与震动位置
  159.   @viewport1.tone = $game_screen.tone
  160.   @viewport1.ox = $game_screen.shake
  161.   # 设置画面的闪烁色
  162.   @viewport4.color = $game_screen.flash_color
  163.   # 刷新显示端口
  164.   @viewport1.update
  165.   @viewport2.update
  166.   @viewport4.update
  167. end
  168. end
  169. #==============================================================================
  170. # ■ Scene_Battle (分割定义 1)
  171. #------------------------------------------------------------------------------
  172. #  处理战斗画面的类。
  173. #==============================================================================

  174. class Scene_Battle
  175. #--------------------------------------------------------------------------
  176. # ● 主处理
  177. #--------------------------------------------------------------------------
  178. def main
  179.   # 初始化战斗用的各种暂时数据
  180.   $game_temp.in_battle = true
  181.   $game_temp.battle_turn = 0
  182.   $game_temp.battle_event_flags.clear
  183.   $game_temp.battle_abort = false
  184.   $game_temp.battle_main_phase = false
  185.   $game_temp.battleback_name = $game_map.battleback_name
  186.   $game_temp.forcing_battler = nil
  187.   # 初始化战斗用事件解释器
  188.   $game_system.battle_interpreter.setup(nil, 0)
  189.   # 准备队伍
  190.   @troop_id = $game_temp.battle_troop_id
  191.   $game_troop.setup(@troop_id)
  192.   # 生成角色命令窗口
  193.   s1 = $data_system.words.attack
  194.   s2 = $data_system.words.skill
  195.   s3 = $data_system.words.guard
  196.   s4 = $data_system.words.item
  197.   @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
  198.   @actor_command_window.y = 160
  199.   @actor_command_window.back_opacity = 160
  200.   @actor_command_window.active = false
  201.   @actor_command_window.visible = false
  202.   # 生成其它窗口
  203.   @party_command_window = Window_PartyCommand.new
  204.   @help_window = Window_Help.new
  205.   @help_window.back_opacity = 160
  206.   @help_window.visible = false
  207.   @status_window = Window_BattleStatus.new
  208.   @message_window = Window_Message.new  
  209.   # 生成活动块
  210.   @spriteset = Spriteset_Battle.new
  211.   # 初始化等待计数
  212.   @wait_count = 0
  213.   # 执行过渡
  214.   if $data_system.battle_transition == ""
  215.     Graphics.transition(20)
  216.   else
  217.     Graphics.transition(40, "Graphics/Transitions/" +
  218.       $data_system.battle_transition)
  219.   end
  220.   # 开始自由战斗回合
  221.   start_phase1
  222.   # 主循环
  223.   loop do
  224.     # 刷新游戏画面
  225.     Graphics.update
  226.     # 刷新输入信息
  227.     Input.update
  228.     # 刷新画面
  229.     update
  230.     # 如果画面切换的话就中断循环
  231.     if $scene != self
  232.       break
  233.     end
  234.   end
  235.   # 刷新地图
  236.   $game_map.refresh
  237.   # 准备过渡
  238.   Graphics.freeze
  239.   # 释放窗口
  240.   @actor_command_window.dispose
  241.   @party_command_window.dispose
  242.   @help_window.dispose
  243.   @status_window.dispose
  244.   @message_window.dispose
  245.   if @skill_window != nil
  246.     @skill_window.dispose
  247.   end
  248.   if @item_window != nil
  249.     @item_window.dispose
  250.   end
  251.   if @result_window != nil
  252.    @result_window.dispose
  253.   end
  254.   # 释放活动块
  255.   @spriteset.dispose
  256.   # 标题画面切换中的情况
  257.   if $scene.is_a?(Scene_Title)
  258.     # 淡入淡出画面
  259.     Graphics.transition
  260.     Graphics.freeze
  261.   end
  262.   # 战斗测试或者游戏结束以外的画面切换中的情况
  263.   if $BTEST and not $scene.is_a?(Scene_Gameover)
  264.     $scene = nil
  265.   end
  266. end
  267. #--------------------------------------------------------------------------
  268. # ● 设置角色指令窗口
  269. #--------------------------------------------------------------------------
  270. def phase3_setup_command_window
  271.   # 同伴指令窗口无效化
  272.   @party_command_window.active = false
  273.   @party_command_window.visible = false
  274.   # 角色指令窗口无效化
  275.   @actor_command_window.active = true
  276.   @actor_command_window.visible = true
  277.   # 设置角色指令窗口的位置
  278.   case $game_party.actors.size
  279.   when 1
  280.     @actor_command_window.x = @actor_index * 160 + 240
  281.   when 2
  282.     @actor_command_window.x = @actor_index * 160 + 160
  283.   when 3
  284.     @actor_command_window.x = @actor_index * 160 + 80
  285.   when 4
  286.     @actor_command_window.x = @actor_index * 160
  287.   end
  288.   # 设置索引为 0
  289.   @actor_command_window.index = 0
  290. end
  291. end

  292. #==============================================================================
  293. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  294. #==============================================================================
复制代码

点评

万分感谢!现在就去认可!  发表于 2011-2-21 22:52
啊咧?新代码窗口看起来感觉怪怪的。。。  发表于 2011-2-21 22:50

评分

参与人数 1星屑 +300 收起 理由
IamI + 300 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-19 00:19

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表