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

Project1

 找回密码
 注册会员
搜索
查看: 2397|回复: 20
打印 上一主题 下一主题

[已经解决] 如何在战斗中改变战斗背景

[复制链接]

Lv2.观梦者

梦石
0
星屑
479
在线时间
30 小时
注册时间
2017-5-30
帖子
56
跳转到指定楼层
1
发表于 2017-10-13 03:34:41 | 只看该作者 |只看大图 回帖奖励 |正序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
如何在战斗中改变战斗背景,我准备了4张图,如果能循环改变,相当于战斗背景是一副动画了

Lv2.观梦者

梦石
0
星屑
479
在线时间
30 小时
注册时间
2017-5-30
帖子
56
10
 楼主| 发表于 2017-10-15 01:23:12 | 只看该作者
樱桃丸子aab 发表于 2017-10-14 14:14
您好!实在辛苦您了,开关兼容了,但是它和烛光脚本又有点兼容,游戏进行到一半的时候有一定几率报错

( ...

谢谢您,完全成功了!我可以加您的联系方式吗,有问题还想请教您,谢谢!
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
479
在线时间
30 小时
注册时间
2017-5-30
帖子
56
9
 楼主| 发表于 2017-10-14 14:14:52 | 只看该作者
本帖最后由 樱桃丸子aab 于 2017-10-14 14:17 编辑

您好!实在辛苦您了,开关兼容了,但是它和烛光脚本又有点兼容,游戏进行到一半的时候有一定几率报错

(您辛苦了!一直提出问题,我也挺不好意思的!如果实在麻烦,就算了,没关系,很感谢您!)

231 行 报 failed to create bitmap

  1. # coding: utf-8
  2. =begin
  3. = Bitmap類拡張 (DLL版)
  4. RPGツクールXP/VX共用
  5. 添加功能 Bitmap 類。
  6. - Marshaldump 啟用
  7. - 保存為PNG文件
  8. -色調變化
  9. -馬賽克效果
  10. -反相顏色
  11. -模糊效果
  12. -使用遮罩-切除
  13. -混合

  14. ■ 注意
  15. 這個腳本需要"tktk_bitmap.dll"(ver0.1.2.6以上)。

  16. Author::    半生
  17. Date::      2010/12/13
  18. Version::   0.1.2.6
  19. URL::       http://www.tktkgame.com/

  20. ################更新########################
  21. 2010/12/13 ver 0.1.2.6
  22.  dll名稱從"hn_rg_bitmap.dll"變更為"tktk_bitmap.dll"
  23.  LARGE_BITMAP機能でメモリを確保できなかった場合の処理を追加
  24. 2010/10/12 ver 0.1.2.5(デンジャラスベータ版)
  25.  大きいサイズのBitmapオブジェクトを機能を試験的に実装(危険)
  26. 2010/03/24 ver 0.1.2.2
  27.  ブレンディング機能関連の軽量化。
  28.  画像連結系メソッドの分離。
  29. 2010/03/24 ver 0.1.2.1
  30.  ブレンディング機能関連のバグフィックス
  31. 2010/03/22 ver 0.1.2.0
  32.  加算合成等のブレンディング機能の追加
  33. 2010/02/07 ver 0.1.1.0
  34.  マーシャル化の処理の一部をDLLに移動
  35. 2010/01/17 ver 0.1.0.0
  36.  dllの名称を"hn_rx_bitmap.dll"から"hn_rg_bitmap.dll"に変更
  37.  モザイク効果・色反転・ぼかし効果の追加
  38. ############################################
  39. =end

  40. module TKTK_Bitmap
  41.   LARGE_BITMAP = true # 是否使用大型點陣圖的功能
  42.   DLL_NAME = 'Dlls/tktk_bitmap'

  43.   ERROR_ALLOCATE_FAILED = -110002

  44.   @@png_save = Win32API.new(DLL_NAME, 'PngSaveA', 'p n i i', 'i')
  45.   @@blur = Win32API.new(DLL_NAME, 'Blur', 'n i', 'i')
  46.   @@change_tone = Win32API.new(DLL_NAME, 'ChangeTone', 'n i i i i', 'i')
  47.   @@clip_mask = Win32API.new(DLL_NAME, 'ClipMask', 'n n i i i', 'i')
  48.   @@invert = Win32API.new(DLL_NAME, 'InvertColor', 'n', 'i')
  49.   @@mosaic = Win32API.new(DLL_NAME, 'Mosaic', 'n i i i i i i', 'i')
  50.   @@address = Win32API.new(DLL_NAME, 'GetAddress', 'n', 'n')
  51.   @@get_pixel_data = Win32API.new(DLL_NAME, 'GetPixelData', 'n p i', 'i')
  52.   @@set_pixel_data = Win32API.new(DLL_NAME, 'SetPixelData', 'n p i', 'i')
  53.   @@blend_blt = Win32API.new(DLL_NAME, 'BlendBlt', 'n i i n i i i i i i', 'i')
  54.   #@@get_hwnd = Win32API.new(DLL_NAME, 'GetGameHWND', 'v', 'l')
  55.   @@change_size = Win32API.new(DLL_NAME, 'ChangeSize', 'n i i', 'i')
  56.   module_function

  57.   # PNG形式儲存
  58.   def png_save(bitmap,file_name,compression_level,filter)
  59.     return @@png_save.call(file_name, bitmap.object_id, compression_level, filter)
  60.   end

  61.   # 模糊效果
  62.   def blur(bitmap, r = 1)
  63.     return @@blur.call(bitmap.object_id, r)
  64.   end
  65.   
  66.   # 更改顏色平衡?
  67.   def change_tone(bitmap, red = 0, green = 0, blue = 0, simplify = 1)
  68.     return @@change_tone.call(bitmap.object_id, red, green, blue, simplify)
  69.   end
  70. # 剪貼蒙版圖像(α乘法)
  71.   def clip_mask(g_bitmap, m_bitmap, x=0, y=0, outer=0)
  72.     return @@clip_mask.call(g_bitmap.object_id, m_bitmap.object_id, x, y, outer)
  73.   end

  74.   # 色的反轉
  75.   def invert(bitmap)
  76.     return @@invert.call(bitmap.object_id)
  77.   end

  78.   # 馬賽克效果
  79.   def mosaic(bitmap, msw=5, msh=5)
  80.     return self.mosaic_rect(bitmap, bitmap.rect, msw, msh)
  81.   end

  82.   # 馬賽克效果(範圍指定)
  83.   def mosaic_rect(bitmap, rect, msw=5, msh=5)
  84.     return @@mosaic.call(bitmap.object_id,
  85.     rect.x, rect.y, rect.width, rect.height, msw, msh)
  86.   end

  87.   # 獲取Bitmap資料位址
  88.   def address(bitmap)
  89.     return @@address.call(bitmap.object_id)
  90.   end
  91.   
  92.   # 二進位資料獲取點Bitmap陣圖
  93.   def get_pixel_data(bitmap)
  94.     buffer = "bgra" * bitmap.width * bitmap.height
  95.     @@get_pixel_data.call(bitmap.object_id, buffer, buffer.size)
  96.     return buffer
  97.   end
  98.   
  99.   #替換為Bitmap中的二進位資料
  100.   def set_pixel_data(bitmap, data)
  101.     return @@set_pixel_data.call(bitmap.object_id, data, data.size)
  102.   end
  103.   
  104.   def blend_blt(dest_bmp, x, y, src_bmp, rect, blend_type=0, opacity=255)
  105.     @@blend_blt.call(dest_bmp.object_id, x, y, src_bmp.object_id,
  106.                 rect.x, rect.y, rect.width, rect.height,
  107.                 blend_type, opacity)
  108.   end

  109.   # 改變Bitmap的大小(風險)
  110.   def change_size(bitmap, new_width, new_height)
  111.     return -1 if (new_width <=0 or new_height <= 0)
  112.     result = @@change_size.call(bitmap.object_id, new_width, new_height)
  113.     if result == ERROR_ALLOCATE_FAILED
  114.       raise("tktk_bitmap:ERROR ALLOCATE FAILED")
  115.     end
  116.     return result
  117.   end
  118.   
  119. end

  120. class Font
  121.   def marshal_dump;end
  122.   def marshal_load(obj);end
  123. end
  124. class Bitmap
  125.   # PNG 壓縮篩檢程式
  126.   PNG_NO_FILTERS   = 0x00
  127.   PNG_FILTER_NONE  = 0x08
  128.   PNG_FILTER_SUB   = 0x10
  129.   PNG_FILTER_UP    = 0x20
  130.   PNG_FILTER_AVG   = 0x40
  131.   PNG_FILTER_PAETH = 0x80
  132.   PNG_ALL_FILTERS  = (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP |
  133.                       PNG_FILTER_AVG | PNG_FILTER_PAETH)

  134.   # Marshal_dump
  135.   def _dump(limit)
  136.     return "" if self.disposed?
  137.     data = TKTK_Bitmap.get_pixel_data(self)
  138.     [width, height, Zlib::Deflate.deflate(data)].pack("LLa*") # ついでに圧縮
  139.   end
  140.   
  141.   # Marshal_load
  142.   def self._load(str)
  143.     if str == ""
  144.       b = Bitmap.new(1,1)
  145.       b.dispose
  146.       return b
  147.     end
  148.     w, h, zdata = str.unpack("LLa*"); b = new(w, h)
  149.     TKTK_Bitmap.set_pixel_data(b, Zlib::Inflate.inflate(zdata))
  150.     return b
  151.   end  
  152.   
  153.   def address
  154.     TKTK_Bitmap.address(self)
  155.   end

  156.   #         模糊效果
  157.   def blur2(r=1)
  158.     TKTK_Bitmap.blur(self, r)
  159.   end

  160.   # 色調變化
  161.   def change_tone(red, green, blue, simplify = 1)
  162.     TKTK_Bitmap.change_tone(self, red, green, blue, simplify)
  163.   end
  164.   
  165.   # 剪切
  166.   def clip_mask(bitmap, x=0, y=0, outer=0)
  167.     TKTK_Bitmap.clip_mask(self, bitmap, x, y, outer)
  168.   end

  169.   # 反相顏色
  170.   def invert
  171.     TKTK_Bitmap.invert(self)
  172.   end

  173.   # 馬賽克效果
  174.   def mosaic(msw=5, msh=5)
  175.     TKTK_Bitmap.mosaic(self, msw, msh)
  176.   end

  177.   # 馬賽克效果 (指定區域)
  178.   def mosaic_rect(rect=self.rect, msw=5, msh=5)
  179.     TKTK_Bitmap.mosaic_rect(self, rect, msw, msh)
  180.   end

  181.   # 混合
  182.   def blend_blt(x, y, src_bmp, rect, blend_type=0, opacity=255)
  183.     return if opacity <= 0
  184.     TKTK_Bitmap.blend_blt(self, x, y, src_bmp, rect, blend_type, opacity)
  185.   end

  186.   #Png 格式保存
  187.   def png_save(outp, level = 9, filter = PNG_NO_FILTERS)
  188.     if (TKTK_Bitmap.png_save(self, outp, level, filter) != 0)
  189.       raise("Bitmap\#png_save failed")
  190.     end
  191.   end

  192.   # 允許更大的 bitmap.new (危険)
  193.   # 寬度 * 高度大約是1073741823
  194.   if TKTK_Bitmap::LARGE_BITMAP
  195.     class << self
  196.       unless method_defined?(:_hn_large_bm__new)
  197.         alias :_hn_large_bm__new :new
  198.       end
  199.       def new(*args)
  200.         if args.size == 2 && args[0] * args[1] >= 4194304
  201.           new_width = args[0]
  202.           new_height = args[1]
  203.           # 暫時以小尺寸作成
  204.           bitmap = _hn_large_bm__new(16, 16)
  205.           TKTK_Bitmap.change_size(bitmap, new_width, new_height)
  206.           return bitmap
  207.         else
  208.           _hn_large_bm__new(*args)
  209.         end
  210.       end
  211.     end # Bitmap.new
  212.   end
  213. end # CLASS Bitmap
复制代码

QQ图片20171014141257.png (6.49 KB, 下载次数: 10)

QQ图片20171014141257.png

点评

谢谢您,完全成功了!我可以加您的联系方式吗,有问题还想请教您,谢谢!  发表于 2017-10-15 01:22
没事,其实我挺闲的。在复制2楼脚本试试,测试好像没什么问题啊  发表于 2017-10-14 14:33
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
479
在线时间
30 小时
注册时间
2017-5-30
帖子
56
8
 楼主| 发表于 2017-10-14 12:53:23 | 只看该作者
本帖最后由 樱桃丸子aab 于 2017-10-14 13:08 编辑
张咚咚 发表于 2017-10-13 09:29
# 僌儔僼傿僢僋僗傾儗僀傪庢摼
      w = XRXS_BP8::GA_W
      h = w * 3 / 4

您好,这行会报未定义方法错误

    xga.stretch_blt(xga.rect, bg, bg.rect)

脚本的496行 发生了 NoMethodError。undefined method 'rect' for nil:NilClass

我分析原因是您把开关限制去掉了

点评

重新复制2楼脚本试试  发表于 2017-10-14 13:59
位置没放错  发表于 2017-10-14 13:50
这个效果我想用在BOSS战,如果不用开关控制的话,碰到普通敌人时会出错  发表于 2017-10-14 13:49
测试时去了开关限制,不过这个和开关限制没关系的,是不是位置放错了  发表于 2017-10-14 13:36
新工程测试没问题的  发表于 2017-10-14 13:33
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
479
在线时间
30 小时
注册时间
2017-5-30
帖子
56
7
 楼主| 发表于 2017-10-13 23:32:03 | 只看该作者
樱桃丸子aab 发表于 2017-10-13 19:36
我已经测试可用了,可是和我的战斗视角移动脚本冲突,您看可以修改吗

...

您好,脚本插入之后可兼容,但是图片有偏移,战斗图整体偏移到了左上角,导致右下角有两块地方是黑色的,没显示(我的战斗图是640*480全屏型的,战斗是采用45度角战斗),还望想想解决办法,万分感谢!

点评

重新复制2楼脚本插入6楼482行  发表于 2017-10-14 08:53
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
479
在线时间
30 小时
注册时间
2017-5-30
帖子
56
6
 楼主| 发表于 2017-10-13 19:36:25 | 只看该作者

我已经测试可用了,可是和我的战斗视角移动脚本冲突,您看可以修改吗

  1. # 仴仯仴 No108. 僶僩儖僶僢僋丒Full-View亄壜摦僇儊儔 仴仯仴
  2. #
  3. # update 2006/ 4/16
  4. #
  5. #==============================================================================
  6. # 仩 僇僗僞儅僀僘億僀儞僩
  7. #==============================================================================
  8. module XRXS_BP8
  9.   #
  10.   # 僇儊儔堏摦懍搙
  11.   #  ( SPEED1 : 嫍棧暘妱悢丅彫偝偄傎偳憗偄
  12.   #    SPEED2 : 嵟掅堏摦懍搙[扨埵:px/F])
  13.   #
  14.   SPEED1 =  8
  15.   SPEED2 =  8
  16.   #
  17.   # GA偺墶暆僒僀僘傪愝掕 ( 1024:XGA僒僀僘丄640:VGA僒僀僘)
  18.   #
  19.   GA_W = 1024
  20. end
  21. #------------------------------------------------------------------------------
  22. # 仱 壜摦僇儊儔偺摦偒愝掕
  23. #------------------------------------------------------------------------------
  24. class Scene_Battle
  25.   #--------------------------------------------------------------------------
  26.   # 仠 僷乕僥傿僐儅儞僪僼僃乕僘奐巒
  27.   #--------------------------------------------------------------------------
  28.   alias xrxs_bp8_start_phase2 start_phase2
  29.   def start_phase2
  30.     # 僇儊儔丗僙儞僞儕儞僌
  31.     $xcam.centering
  32.     # 屇傃栠偡
  33.     xrxs_bp8_start_phase2
  34.   end
  35.   #--------------------------------------------------------------------------
  36.   # 仠 僼儗乕儉峏怴 (傾僋僞乕僐儅儞僪僼僃乕僘 : 僄僱儈乕慖戰)
  37.   #--------------------------------------------------------------------------
  38.   alias xrxs_bp8_update_phase3_enemy_select update_phase3_enemy_select
  39.   def update_phase3_enemy_select
  40.     # 尰嵼慖戰拞偺僄僱儈乕傪庢摼
  41.     enemy = $game_troop.enemies[@enemy_arrow.index]
  42.     # 僇儊儔丗拲栚
  43.     if @last_enemy_arrow != enemy
  44.       $xcam.watch(enemy)
  45.       @last_enemy_arrow = enemy
  46.     end
  47.     # 栠偡
  48.     xrxs_bp8_update_phase3_enemy_select
  49.   end
  50.   #--------------------------------------------------------------------------
  51.   # 仠 僄僱儈乕慖戰廔椆
  52.   #--------------------------------------------------------------------------
  53.   alias xrxs_bp8_end_enemy_select end_enemy_select
  54.   def end_enemy_select
  55.     # 僇儊儔丗僙儞僞儕儞僌
  56.     $xcam.centering
  57.     @last_enemy_arrow = nil
  58.     # 屇傃栠偡
  59.     xrxs_bp8_end_enemy_select
  60.   end
  61.   #--------------------------------------------------------------------------
  62.   # 仠 僼儗乕儉峏怴 (儊僀儞僼僃乕僘 僗僥僢僾 2 : 傾僋僔儑儞奐巒)
  63.   #--------------------------------------------------------------------------
  64.   alias xrxs_bp8_update_phase4_step2 update_phase4_step2
  65.   def update_phase4_step2
  66.     # 栠偡
  67.     xrxs_bp8_update_phase4_step2
  68.     # 僗僥僢僾 3 偵堏峴偡傞梊掕偺応崌
  69.     if @phase4_step == 3
  70.       # 傾僋僥傿僽側僶僩儔乕偑僶僩儖僼傿乕儖僪偵嫃傞応崌
  71.       if @active_battler.in_battlefield?
  72.         # 僇儊儔丗拲栚
  73.         $xcam.watch(@active_battler)
  74.       end
  75.     end
  76.   end
  77.   #--------------------------------------------------------------------------
  78.   # 仠 僼儗乕儉峏怴 (儊僀儞僼僃乕僘 僗僥僢僾 3 : 峴摦懁傾僯儊乕僔儑儞)
  79.   #--------------------------------------------------------------------------
  80.   alias xrxs_bp8_update_phase4_step3 update_phase4_step3
  81.   def update_phase4_step3
  82.     # 栠偡
  83.     xrxs_bp8_update_phase4_step3
  84.     # 僇儊儔僞乕僎僢僩偲側傝偆傞僞乕僎僢僩偺 X 暯嬒抣傪寁嶼
  85.     x_average  = 0
  86.     number     = 0
  87.     cam_target = nil
  88.     for target in @target_battlers
  89.       if target.in_battlefield?
  90.         x_average += target.x
  91.         number    += 1
  92.         cam_target = target
  93.       end
  94.     end
  95.     # 僇儊儔僞乕僎僢僩偑尒偮偐偭偨応崌
  96.     if number > 0
  97.       # 傕偟懳徾傾僯儊偑乽埵抲丗夋柺乿偺応崌
  98.       animation = $data_animations[@animation2_id]
  99.       if animation != nil and animation.position == 3
  100.         # 僇儊儔丗僙儞僞儕儞僌
  101.         $xcam.centering
  102.         # 僇儊儔丗僘乕儉傾僂僩
  103.         $xcam.zoomout
  104.       elsif number == 1
  105.         # 僇儊儔丗拲栚
  106.         $xcam.watch(cam_target)
  107.       else
  108.         # 僇儊儔丗巜掕 X 埵抲傪拲栚
  109.         $xcam.watch_at(x_average / number)
  110.       end
  111.     end
  112.   end
  113.   #--------------------------------------------------------------------------
  114.   # 仠 傾僼僞乕僶僩儖僼僃乕僘奐巒
  115.   #--------------------------------------------------------------------------
  116.   alias xrxs_bp8_start_phase5 start_phase5
  117.   def start_phase5
  118.     # 僇儊儔丗僙儞僞儕儞僌
  119.     $xcam.centering
  120.     # 屇傃栠偡
  121.     xrxs_bp8_start_phase5
  122.   end
  123. end
  124. #------------------------------------------------------------------------------
  125. # 僇僗僞儅僀僘億僀儞僩偙偙傑偱
  126. #==============================================================================

  127. #------------------------------------------------------------------------------
  128. #
  129. #    仱 壜摦僇儊儔 僔僗僥儉 仱
  130. #
  131. #==============================================================================
  132. # 仩 XCam
  133. #------------------------------------------------------------------------------
  134. #   壜摦僇儊儔傪埖偆僋儔僗偱偡丅
  135. #==============================================================================
  136. class XCam
  137.   #--------------------------------------------------------------------------
  138.   # 仜 岞奐僀儞僗僞儞僗曄悢
  139.   #--------------------------------------------------------------------------
  140.   attr_reader   :x
  141.   attr_reader   :y
  142.   attr_reader   :z
  143.   attr_accessor :x_destination
  144.   attr_accessor :y_destination
  145.   attr_accessor :z_destination
  146.   attr_accessor :watch_battler
  147.   attr_accessor :freeze_count
  148.   #--------------------------------------------------------------------------
  149.   # 仜 僆僽僕僃僋僩弶婜壔
  150.   #--------------------------------------------------------------------------
  151.   def initialize
  152.     # 僇儊儔弶婜埵抲寛掕
  153.     @x = 320
  154.     @y = 240
  155.     @z = 296
  156.     # 嵟戝斖埻偺寁嶼
  157.     @x_max = 0
  158.     @y_max = 0
  159.     @z_max = XRXS_BP8::GA_W * 37 / 128
  160.     # Z偺嵟戝惂尷
  161.     @z = @z_max if @z > @z_max
  162.     # 僇儊儔丗僙儞僞儕儞僌
  163.     self.centering
  164.     # 弶婜壔
  165.     @freeze_count = 0
  166.   end
  167.   #--------------------------------------------------------------------------
  168.   # 仜 僼儗乕儉峏怴
  169.   #--------------------------------------------------------------------------
  170.   def update
  171.     @moved = false
  172.     # 僇儊儔埵抲偺峏怴
  173.     if @freeze_count > 0
  174.       # 僼儕乕僘僇僂儞僩傪尭傜偡
  175.       @freeze_count -= 1
  176.       return
  177.     end
  178.     # 嵗昗庢摼
  179.     z_dest = @z_destination
  180.     x_dest = @watch_battler == nil ? @x_destination : @watch_battler.x
  181.     y_dest = @watch_battler == nil ? @y_destination : 88 + @watch_battler.y/2
  182.     # 僇儊儔: Z 嵗昗 (桪愭)
  183.     if @z != z_dest
  184.       @z     = slide(@z, z_dest, @z_speed, 37, @z_max)
  185.       @x_max = (@z_max - @z) * 64 / 37
  186.       @y_max = (@z_max - @z) * 48 / 37
  187.       @moved = true
  188.     end
  189.     # 僇儊儔: X 嵗昗
  190.     if @x != x_dest or @moved
  191.       @x = slide(@x, x_dest, @x_speed, 320 - @x_max, 320 + @x_max)
  192.       @moved = true
  193.     end
  194.     # 僇儊儔: Y 嵗昗
  195.     if @y != y_dest or @moved
  196.       @y = slide(@y, y_dest, @y_speed, 240 - @y_max, 240 + @y_max)
  197.       @moved = true
  198.     end
  199.   end
  200.   #--------------------------------------------------------------------------
  201.   # 仜 僗儔僀僪 (尰嵼抧丒栚揑抧偐傜峴偔傋偒尰嵼抧傪曉偡)
  202.   #--------------------------------------------------------------------------
  203.   def slide(from, to, move_speed, to_min, to_max)
  204.     # 寢壥傪敾暿
  205.     if (to - from).abs < move_speed
  206.       result = to
  207.     else
  208.       sign   = from > to ? -1 : 1
  209.       result = from + sign * move_speed
  210.     end
  211.     # 斖埻偵傛偭偰曉媝
  212.     return [[result, to_min].max, to_max].min
  213.   end
  214.   #--------------------------------------------------------------------------
  215.   # 仜 摦偄偨偐偳偆偐丠
  216.   #--------------------------------------------------------------------------
  217.   def moved?
  218.     return @moved
  219.   end
  220.   #--------------------------------------------------------------------------
  221.   # 仜 僇儊儔懍搙愝掕
  222.   #--------------------------------------------------------------------------
  223.   def set_speed
  224.     x_dest = @watch_battler == nil ? @x_destination : @watch_battler.x
  225.     y_dest = @watch_battler == nil ? @y_destination : 88 + @watch_battler.y/2
  226.     z_dest = @z_destination
  227.     @x_speed = [[(x_dest - @x).abs / XRXS_BP8::SPEED1, 1].max, XRXS_BP8::SPEED2].min
  228.     @y_speed = [[(y_dest - @y).abs / XRXS_BP8::SPEED1, 1].max, XRXS_BP8::SPEED2].min
  229.     @z_speed = [[(z_dest - @z).abs / XRXS_BP8::SPEED1, 1].max, XRXS_BP8::SPEED2].min
  230.   end
  231.   #--------------------------------------------------------------------------
  232.   # 仜 僙儞僞儕儞僌
  233.   #--------------------------------------------------------------------------
  234.   def centering
  235.     @watch_battler = nil
  236.     @x_destination = 320
  237.     @y_destination = 240
  238.     @z_destination = 185
  239.     set_speed
  240.   end
  241.   #--------------------------------------------------------------------------
  242.   # 仜 僘乕儉傾僂僩
  243.   #--------------------------------------------------------------------------
  244.   def zoomout
  245.     @z_destination = 222
  246.     set_speed
  247.   end
  248.   #--------------------------------------------------------------------------
  249.   # 仜 僶僩儔乕傪拲栚
  250.   #--------------------------------------------------------------------------
  251.   def watch(battler)
  252.     @watch_battler = battler
  253.     @z_destination = 180
  254.     set_speed
  255.   end
  256.   #--------------------------------------------------------------------------
  257.   # 仜 巜掕 X 埵抲傪拲栚
  258.   #--------------------------------------------------------------------------
  259.   def watch_at(x)
  260.     @watch_battler = nil
  261.     @x_destination =   x
  262.     @y_destination = 240
  263.     @z_destination = 185
  264.     set_speed
  265.   end
  266.   #--------------------------------------------------------------------------
  267.   # 仜 僘乕儉攞棪偺庢摼
  268.   #--------------------------------------------------------------------------
  269.   def zoom
  270.     return 185.00 / self.z
  271.   end
  272. end
  273. #==============================================================================
  274. # 仭 Game_Battler
  275. #==============================================================================
  276. class Game_Battler
  277.   #--------------------------------------------------------------------------
  278.   # 仜 岞奐僀儞僗僞儞僗曄悢
  279.   #--------------------------------------------------------------------------
  280.   attr_reader   :x                        # 僶僩儖僼傿乕儖僪丂墶丂埵抲(+偑塃丂)
  281.   attr_reader   :y                        # 僶僩儖僼傿乕儖僪 崅偝 埵抲(+偑壓丂)
  282.   attr_reader   :z                        # 僶僩儖僼傿乕儖僪墱峴偒埵抲(+偑庤慜)
  283.   #--------------------------------------------------------------------------
  284.   # 仜 僶僩儖僼傿乕儖僪忋偵嫃傞偐丠
  285.   #--------------------------------------------------------------------------
  286.   def in_battlefield?
  287.     return false
  288.   end
  289. end
  290. #==============================================================================
  291. # 仭 Game_Enemy
  292. #==============================================================================
  293. class Game_Enemy < Game_Battler
  294.   #--------------------------------------------------------------------------
  295.   # 仜 僶僩儖僼傿乕儖僪忋偵嫃傞偐丠 [僆乕僶乕儔僀僪]
  296.   #--------------------------------------------------------------------------
  297.   def in_battlefield?
  298.     return true
  299.   end
  300.   #--------------------------------------------------------------------------
  301.   # 仠 僆僽僕僃僋僩弶婜壔
  302.   #--------------------------------------------------------------------------
  303.   alias xrxs_bp8_initialize initialize
  304.   def initialize(troop_id, member_index)
  305.     @z = 0
  306.     xrxs_bp8_initialize(troop_id, member_index)
  307.   end
  308.   #--------------------------------------------------------------------------
  309.   # 仠 僶僩儖夋柺 X 嵗昗偺庢摼
  310.   #--------------------------------------------------------------------------
  311.   alias x screen_x
  312.   def screen_x
  313.     return self.x if $xcam == nil
  314.     return 320 + (self.x - $xcam.x) * 185 / $xcam.z
  315.   end
  316.   #--------------------------------------------------------------------------
  317.   # 仠 僶僩儖夋柺 Y 嵗昗偺庢摼
  318.   #--------------------------------------------------------------------------
  319.   alias y screen_y
  320.   def screen_y
  321.     return self.y if $xcam == nil
  322.     return 240 + (self.y - $xcam.y) * 185 / $xcam.z
  323.   end
  324. end
  325. #==============================================================================
  326. # 仭 Spriteset_Battle
  327. #==============================================================================
  328. class Spriteset_Battle
  329.   #--------------------------------------------------------------------------
  330.   # 仜 僼儗乕儉峏怴 (壜摦僇儊儔)
  331.   #--------------------------------------------------------------------------
  332.   def update_xcam
  333.     # 僇儊儔埵抲偑摦偄偨応崌
  334.     if $xcam.moved?
  335.       # 僇儊儔埵抲偐傜僘乕儉棪傪寁嶼
  336.       zoom = 185.00 / $xcam.z
  337.       w = XRXS_BP8::GA_W / 2
  338.       h = w * 3 / 4
  339.       # 攚宨偺愝掕峏怴
  340.       @battleback_sprite.zoom_x = zoom
  341.       @battleback_sprite.zoom_y = zoom
  342.       @battleback_sprite.x      = (320 - $xcam.x) * zoom - w * (zoom - 1)
  343.       @battleback_sprite.y      = (240 - $xcam.y) * zoom - h * (zoom - 1)
  344.     end
  345.   end
  346. end
  347. #==============================================================================
  348. # --- 僶僩儔乕僗僾儔僀僩丒壜摦僇儊儔揔梡 ---
  349. #==============================================================================
  350. module XRXS_Cam_Deal
  351.   def update
  352.     # 屇傃栠偡
  353.     super
  354.     # 僶僩儔乕偑僶僩儖僼傿乕儖僪偵偄側偄応崌偼廔椆
  355.     return if @battler == nil or not @battler.in_battlefield?
  356.     # 僌儔僼傿僢僋偑枹愝掕側応崌偼廔椆
  357.     return if self.bitmap == nil
  358.     # 僘乕儉棪偺曄峏 ( 僗僾儔僀僩嵗昗偺嵞愝掕偼尦偺儊僜僢僪偵擟偣傞 )
  359.     zoom = 1.00 * 185 / (185 - @battler.z)
  360.     self.zoom_x = zoom * $xcam.zoom
  361.     self.zoom_y = zoom * $xcam.zoom
  362.   end
  363. end
  364. class Sprite_Battler < RPG::Sprite
  365.   include XRXS_Cam_Deal
  366. end
  367. #==============================================================================
  368. # --- 僟儊乕僕僼僅儘乕 儌僕儏乕儖 ---
  369. #==============================================================================
  370. module XRXS_DamageFollow
  371.   def update
  372.     # 屇傃栠偡
  373.     super
  374.     # 僇儊儔偑懚嵼偟側偄応崌
  375.     return if $xcam == nil
  376.     # 僶僩儔乕偑 nil 傑偨偼僶僩儖僼傿乕儖僪偵偄側偄応崌
  377.     return if @battler == nil or not @battler.in_battlefield?
  378.     # 捈慜僇儊儔埵抲偐傜丄堏摦検傪嶼弌
  379.     x_moved = @last_cam_x == nil ? 0 : $xcam.x - @last_cam_x
  380.     y_moved = @last_cam_y == nil ? 0 : $xcam.y - @last_cam_y
  381.     # 僟儊乕僕僗僾儔僀僩攝楍偺嶌惉
  382.     damage_sprites  = [@_damage_sprite]
  383.     damage_sprites += @damage_sprites if @damage_sprites != nil
  384.     # 僇儊儔傪僼僅儘乕
  385.     for sprite in damage_sprites
  386.       next if sprite == nil
  387.       next if sprite.disposed?
  388.       sprite.x -= x_moved
  389.       sprite.y -= y_moved
  390.     end
  391.     # 捈慜僇儊儔埵抲偺曐帩
  392.     @last_cam_x = $xcam.x
  393.     @last_cam_y = $xcam.y
  394.   end
  395. end
  396. class Sprite_Battler < RPG::Sprite
  397.   include XRXS_DamageFollow
  398. end
  399. #==============================================================================
  400. # 仭 Scene_Battle
  401. #==============================================================================
  402. class Scene_Battle
  403.   #--------------------------------------------------------------------------
  404.   # 仠 儊僀儞張棟
  405.   #--------------------------------------------------------------------------
  406.   alias xrxs_bp8_main main
  407.   def main
  408.     # 壜摦僇儊儔偺惗惉
  409.     $xcam = XCam.new
  410.     # 栠偡
  411.     xrxs_bp8_main
  412.     # 壜摦僇儊儔偺夝曻
  413.     $xcam = nil
  414.   end
  415.   #--------------------------------------------------------------------------
  416.   # 仠 僼儗乕儉峏怴
  417.   #--------------------------------------------------------------------------
  418.   alias xrxs_bp8_update update
  419.   def update
  420.     # 壜摦僇儊儔偺僼儗乕儉峏怴
  421.     $xcam.update
  422.     # 屇傃栠偡
  423.     xrxs_bp8_update
  424.   end
  425. end
  426. #------------------------------------------------------------------------------
  427. #
  428. #    仱 Full-View 僔僗僥儉 仱
  429. #
  430. #==============================================================================
  431. # 仭 Spriteset_Battle
  432. #==============================================================================
  433. class Spriteset_Battle
  434.   #--------------------------------------------------------------------------
  435.   # 仠 僆僽僕僃僋僩弶婜壔
  436.   #--------------------------------------------------------------------------
  437.   alias xrxs_bp8_initialize initialize
  438.   def initialize
  439.     # 屇傃栠偡
  440.     xrxs_bp8_initialize
  441.     # 僌儔僼傿僢僋僗傾儗僀傪庢摼
  442.     # 價儏乕億乕僩 0 傪嶌惉
  443.     w = XRXS_BP8::GA_W
  444.     h = w * 3 / 4
  445.     x = 320 - w / 2
  446.     y = 240 - h / 2
  447.     @viewport0 = Viewport.new(x, y, w, h)
  448.     @viewport0.z  = 0
  449.     # 價儏乕億乕僩 1 偺愝掕傪曄峏
  450.     @viewport1.z += 1
  451.     @viewport1.rect.height = 480
  452.     # 僶僩儖僶僢僋僗僾儔僀僩傪嵞嶌惉 (價儏乕億乕僩 0 傪巊梡)
  453.     @battleback_sprite.dispose
  454.     @battleback_sprite = Sprite.new(@viewport0)
  455.     @battleback_name = ""
  456.     # 僶僩儖僶僢僋偺僼儗乕儉峏怴
  457.     update_battleback
  458.   end
  459.   #--------------------------------------------------------------------------
  460.   # 仠 夝曻
  461.   #--------------------------------------------------------------------------
  462.   alias xrxs_bp8_dispose dispose
  463.   def dispose
  464.     # 屇傃栠偡
  465.     xrxs_bp8_dispose
  466.     # 價儏乕億乕僩傪夝曻
  467.     @viewport0.dispose
  468.   end
  469.   #--------------------------------------------------------------------------
  470.   # 仠 僼儗乕儉峏怴
  471.   #--------------------------------------------------------------------------
  472.   alias xrxs_bp8_update update
  473.   def update
  474.     # 僼儗乕儉峏怴 (僶僩儖僶僢僋)
  475.     update_battleback
  476.     # 僼儗乕儉峏怴 (壜摦僇儊儔)
  477.     update_xcam if defined? update_xcam
  478.     # 屇傃栠偡
  479.     xrxs_bp8_update
  480.     # 夋柺偺僔僃僀僋埵抲傪愝掕
  481.     @viewport0.ox = $game_screen.shake if @viewport0 != nil
  482.   end
  483.   #--------------------------------------------------------------------------
  484.   # 仜 僼儗乕儉峏怴 (僶僩儖僶僢僋)
  485.   #--------------------------------------------------------------------------
  486.   def update_battleback
  487.     # 僶僩儖僶僢僋偺僼傽僀儖柤偑尰嵼偺傕偺偲堘偆応崌
  488.     if @battleback_name != $game_temp.battleback_name
  489.       @battleback_name = $game_temp.battleback_name
  490.       if @battleback_sprite.bitmap != nil
  491.         @battleback_sprite.bitmap.dispose
  492.       end
  493.       # 僌儔僼傿僢僋僗傾儗僀傪庢摼
  494.       w = XRXS_BP8::GA_W
  495.       h = w * 3 / 4
  496.       # 僶僩儖僶僢僋偺庢摼偲奼戝
  497.       bg   = RPG::Cache.battleback(@battleback_name)
  498.       xga  = Bitmap.new(w, h)
  499.       xga.stretch_blt(xga.rect, bg, bg.rect)
  500.       # XGA傪僶僩儖僶僢僋偵愝掕
  501.       @battleback_sprite.bitmap = xga
  502.     end
  503.   end
  504. end
  505. #==============================================================================
  506. # ---乽愴摤拞偺"夋柺"傾僯儊偺埵抲廋惓乿儌僕儏乕儖 ---
  507. #==============================================================================
  508. module XRXS_FullScreen_AnimationOffset
  509.   def animation_set_sprites(sprites, cell_data, position)
  510.     super
  511.     for i in 0..15
  512.       sprite = sprites[i]
  513.       pattern = cell_data[i, 0]
  514.       if sprite == nil or pattern == nil or pattern == -1
  515.         next
  516.       end
  517.       if position == 3
  518.         if self.viewport != nil
  519.           sprite.y = 160 # 偙偺堦峴偩偗曄峏
  520.           sprite.y += cell_data[i, 2]
  521.         end
  522.       end
  523.     end
  524.   end
  525. end
  526. class Sprite_Battler < RPG::Sprite
  527.   include XRXS_FullScreen_AnimationOffset
  528. end

复制代码

点评

您好,脚本插入之后可兼容,但是图片有偏移,战斗图整体偏移到了左上角,导致右下角有两块地方是黑色的,没显示(我的战斗图是640*480全屏型的...  发表于 2017-10-13 23:32
482行后面加入2楼脚本的8-13行  发表于 2017-10-13 21:53
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
479
在线时间
30 小时
注册时间
2017-5-30
帖子
56
5
 楼主| 发表于 2017-10-13 19:09:55 | 只看该作者
樱桃丸子aab 发表于 2017-10-13 18:51
我刚插入了这个脚本,发现战斗背景不会变啊……

新建工程里可以用,我自己的工程里不能用,有哪些注意点吗
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
479
在线时间
30 小时
注册时间
2017-5-30
帖子
56
4
 楼主| 发表于 2017-10-13 18:51:37 | 只看该作者
樱桃丸子aab 发表于 2017-10-13 12:53
您好,能否用一个开关控制它,我只想在某场战斗中循环战斗背景,谢谢

我刚插入了这个脚本,发现战斗背景不会变啊……
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
479
在线时间
30 小时
注册时间
2017-5-30
帖子
56
3
 楼主| 发表于 2017-10-13 12:53:04 | 只看该作者

您好,能否用一个开关控制它,我只想在某场战斗中循环战斗背景,谢谢

点评

重新复制楼上脚本,一号开关控制  发表于 2017-10-13 13:26
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
19334
在线时间
3077 小时
注册时间
2013-1-11
帖子
1288
2
发表于 2017-10-13 09:29:39 | 只看该作者
本帖最后由 张咚咚 于 2017-10-14 14:32 编辑
  1. # 仴仯仴 No108. 僶僩儖僶僢僋丒Full-View亄壜摦僇儊儔 仴仯仴
  2. #
  3. # update 2006/ 4/16
  4. #
  5. #==============================================================================
  6. # 仩 僇僗僞儅僀僘億僀儞僩
  7. #==============================================================================
  8. module XRXS_BP8
  9.   #
  10.   # 僇儊儔堏摦懍搙
  11.   #  ( SPEED1 : 嫍棧暘妱悢丅彫偝偄傎偳憗偄
  12.   #    SPEED2 : 嵟掅堏摦懍搙[扨埵:px/F])
  13.   #
  14.   SPEED1 =  8
  15.   SPEED2 =  8
  16.   #
  17.   # GA偺墶暆僒僀僘傪愝掕 ( 1024:XGA僒僀僘丄640:VGA僒僀僘)
  18.   #
  19.   GA_W = 1024
  20. end
  21. #------------------------------------------------------------------------------
  22. # 仱 壜摦僇儊儔偺摦偒愝掕
  23. #------------------------------------------------------------------------------
  24. class Scene_Battle
  25.   #--------------------------------------------------------------------------
  26.   # 仠 僷乕僥傿僐儅儞僪僼僃乕僘奐巒
  27.   #--------------------------------------------------------------------------
  28.   alias xrxs_bp8_start_phase2 start_phase2
  29.   def start_phase2
  30.     # 僇儊儔丗僙儞僞儕儞僌
  31.     $xcam.centering
  32.     # 屇傃栠偡
  33.     xrxs_bp8_start_phase2
  34.   end
  35.   #--------------------------------------------------------------------------
  36.   # 仠 僼儗乕儉峏怴 (傾僋僞乕僐儅儞僪僼僃乕僘 : 僄僱儈乕慖戰)
  37.   #--------------------------------------------------------------------------
  38.   alias xrxs_bp8_update_phase3_enemy_select update_phase3_enemy_select
  39.   def update_phase3_enemy_select
  40.     # 尰嵼慖戰拞偺僄僱儈乕傪庢摼
  41.     enemy = $game_troop.enemies[@enemy_arrow.index]
  42.     # 僇儊儔丗拲栚
  43.     if @last_enemy_arrow != enemy
  44.       $xcam.watch(enemy)
  45.       @last_enemy_arrow = enemy
  46.     end
  47.     # 栠偡
  48.     xrxs_bp8_update_phase3_enemy_select
  49.   end
  50.   #--------------------------------------------------------------------------
  51.   # 仠 僄僱儈乕慖戰廔椆
  52.   #--------------------------------------------------------------------------
  53.   alias xrxs_bp8_end_enemy_select end_enemy_select
  54.   def end_enemy_select
  55.     # 僇儊儔丗僙儞僞儕儞僌
  56.     $xcam.centering
  57.     @last_enemy_arrow = nil
  58.     # 屇傃栠偡
  59.     xrxs_bp8_end_enemy_select
  60.   end
  61.   #--------------------------------------------------------------------------
  62.   # 仠 僼儗乕儉峏怴 (儊僀儞僼僃乕僘 僗僥僢僾 2 : 傾僋僔儑儞奐巒)
  63.   #--------------------------------------------------------------------------
  64.   alias xrxs_bp8_update_phase4_step2 update_phase4_step2
  65.   def update_phase4_step2
  66.     # 栠偡
  67.     xrxs_bp8_update_phase4_step2
  68.     # 僗僥僢僾 3 偵堏峴偡傞梊掕偺応崌
  69.     if @phase4_step == 3
  70.       # 傾僋僥傿僽側僶僩儔乕偑僶僩儖僼傿乕儖僪偵嫃傞応崌
  71.       if @active_battler.in_battlefield?
  72.         # 僇儊儔丗拲栚
  73.         $xcam.watch(@active_battler)
  74.       end
  75.     end
  76.   end
  77.   #--------------------------------------------------------------------------
  78.   # 仠 僼儗乕儉峏怴 (儊僀儞僼僃乕僘 僗僥僢僾 3 : 峴摦懁傾僯儊乕僔儑儞)
  79.   #--------------------------------------------------------------------------
  80.   alias xrxs_bp8_update_phase4_step3 update_phase4_step3
  81.   def update_phase4_step3
  82.     # 栠偡
  83.     xrxs_bp8_update_phase4_step3
  84.     # 僇儊儔僞乕僎僢僩偲側傝偆傞僞乕僎僢僩偺 X 暯嬒抣傪寁嶼
  85.     x_average  = 0
  86.     number     = 0
  87.     cam_target = nil
  88.     for target in @target_battlers
  89.       if target.in_battlefield?
  90.         x_average += target.x
  91.         number    += 1
  92.         cam_target = target
  93.       end
  94.     end
  95.     # 僇儊儔僞乕僎僢僩偑尒偮偐偭偨応崌
  96.     if number > 0
  97.       # 傕偟懳徾傾僯儊偑乽埵抲丗夋柺乿偺応崌
  98.       animation = $data_animations[@animation2_id]
  99.       if animation != nil and animation.position == 3
  100.         # 僇儊儔丗僙儞僞儕儞僌
  101.         $xcam.centering
  102.         # 僇儊儔丗僘乕儉傾僂僩
  103.         $xcam.zoomout
  104.       elsif number == 1
  105.         # 僇儊儔丗拲栚
  106.         $xcam.watch(cam_target)
  107.       else
  108.         # 僇儊儔丗巜掕 X 埵抲傪拲栚
  109.         $xcam.watch_at(x_average / number)
  110.       end
  111.     end
  112.   end
  113.   #--------------------------------------------------------------------------
  114.   # 仠 傾僼僞乕僶僩儖僼僃乕僘奐巒
  115.   #--------------------------------------------------------------------------
  116.   alias xrxs_bp8_start_phase5 start_phase5
  117.   def start_phase5
  118.     # 僇儊儔丗僙儞僞儕儞僌
  119.     $xcam.centering
  120.     # 屇傃栠偡
  121.     xrxs_bp8_start_phase5
  122.   end
  123. end
  124. #------------------------------------------------------------------------------
  125. # 僇僗僞儅僀僘億僀儞僩偙偙傑偱
  126. #==============================================================================

  127. #------------------------------------------------------------------------------
  128. #
  129. #    仱 壜摦僇儊儔 僔僗僥儉 仱
  130. #
  131. #==============================================================================
  132. # 仩 XCam
  133. #------------------------------------------------------------------------------
  134. #   壜摦僇儊儔傪埖偆僋儔僗偱偡丅
  135. #==============================================================================
  136. class XCam
  137.   #--------------------------------------------------------------------------
  138.   # 仜 岞奐僀儞僗僞儞僗曄悢
  139.   #--------------------------------------------------------------------------
  140.   attr_reader   :x
  141.   attr_reader   :y
  142.   attr_reader   :z
  143.   attr_accessor :x_destination
  144.   attr_accessor :y_destination
  145.   attr_accessor :z_destination
  146.   attr_accessor :watch_battler
  147.   attr_accessor :freeze_count
  148.   #--------------------------------------------------------------------------
  149.   # 仜 僆僽僕僃僋僩弶婜壔
  150.   #--------------------------------------------------------------------------
  151.   def initialize
  152.     # 僇儊儔弶婜埵抲寛掕
  153.     @x = 320
  154.     @y = 240
  155.     @z = 296
  156.     # 嵟戝斖埻偺寁嶼
  157.     @x_max = 0
  158.     @y_max = 0
  159.     @z_max = XRXS_BP8::GA_W * 37 / 128
  160.     # Z偺嵟戝惂尷
  161.     @z = @z_max if @z > @z_max
  162.     # 僇儊儔丗僙儞僞儕儞僌
  163.     self.centering
  164.     # 弶婜壔
  165.     @freeze_count = 0
  166.   end
  167.   #--------------------------------------------------------------------------
  168.   # 仜 僼儗乕儉峏怴
  169.   #--------------------------------------------------------------------------
  170.   def update
  171.     @moved = false
  172.     # 僇儊儔埵抲偺峏怴
  173.     if @freeze_count > 0
  174.       # 僼儕乕僘僇僂儞僩傪尭傜偡
  175.       @freeze_count -= 1
  176.       return
  177.     end
  178.     # 嵗昗庢摼
  179.     z_dest = @z_destination
  180.     x_dest = @watch_battler == nil ? @x_destination : @watch_battler.x
  181.     y_dest = @watch_battler == nil ? @y_destination : 88 + @watch_battler.y/2
  182.     # 僇儊儔: Z 嵗昗 (桪愭)
  183.     if @z != z_dest
  184.       @z     = slide(@z, z_dest, @z_speed, 37, @z_max)
  185.       @x_max = (@z_max - @z) * 64 / 37
  186.       @y_max = (@z_max - @z) * 48 / 37
  187.       @moved = true
  188.     end
  189.     # 僇儊儔: X 嵗昗
  190.     if @x != x_dest or @moved
  191.       @x = slide(@x, x_dest, @x_speed, 320 - @x_max, 320 + @x_max)
  192.       @moved = true
  193.     end
  194.     # 僇儊儔: Y 嵗昗
  195.     if @y != y_dest or @moved
  196.       @y = slide(@y, y_dest, @y_speed, 240 - @y_max, 240 + @y_max)
  197.       @moved = true
  198.     end
  199.   end
  200.   #--------------------------------------------------------------------------
  201.   # 仜 僗儔僀僪 (尰嵼抧丒栚揑抧偐傜峴偔傋偒尰嵼抧傪曉偡)
  202.   #--------------------------------------------------------------------------
  203.   def slide(from, to, move_speed, to_min, to_max)
  204.     # 寢壥傪敾暿
  205.     if (to - from).abs < move_speed
  206.       result = to
  207.     else
  208.       sign   = from > to ? -1 : 1
  209.       result = from + sign * move_speed
  210.     end
  211.     # 斖埻偵傛偭偰曉媝
  212.     return [[result, to_min].max, to_max].min
  213.   end
  214.   #--------------------------------------------------------------------------
  215.   # 仜 摦偄偨偐偳偆偐丠
  216.   #--------------------------------------------------------------------------
  217.   def moved?
  218.     return @moved
  219.   end
  220.   #--------------------------------------------------------------------------
  221.   # 仜 僇儊儔懍搙愝掕
  222.   #--------------------------------------------------------------------------
  223.   def set_speed
  224.     x_dest = @watch_battler == nil ? @x_destination : @watch_battler.x
  225.     y_dest = @watch_battler == nil ? @y_destination : 88 + @watch_battler.y/2
  226.     z_dest = @z_destination
  227.     @x_speed = [[(x_dest - @x).abs / XRXS_BP8::SPEED1, 1].max, XRXS_BP8::SPEED2].min
  228.     @y_speed = [[(y_dest - @y).abs / XRXS_BP8::SPEED1, 1].max, XRXS_BP8::SPEED2].min
  229.     @z_speed = [[(z_dest - @z).abs / XRXS_BP8::SPEED1, 1].max, XRXS_BP8::SPEED2].min
  230.   end
  231.   #--------------------------------------------------------------------------
  232.   # 仜 僙儞僞儕儞僌
  233.   #--------------------------------------------------------------------------
  234.   def centering
  235.     @watch_battler = nil
  236.     @x_destination = 320
  237.     @y_destination = 240
  238.     @z_destination = 185
  239.     set_speed
  240.   end
  241.   #--------------------------------------------------------------------------
  242.   # 仜 僘乕儉傾僂僩
  243.   #--------------------------------------------------------------------------
  244.   def zoomout
  245.     @z_destination = 222
  246.     set_speed
  247.   end
  248.   #--------------------------------------------------------------------------
  249.   # 仜 僶僩儔乕傪拲栚
  250.   #--------------------------------------------------------------------------
  251.   def watch(battler)
  252.     @watch_battler = battler
  253.     @z_destination = 180
  254.     set_speed
  255.   end
  256.   #--------------------------------------------------------------------------
  257.   # 仜 巜掕 X 埵抲傪拲栚
  258.   #--------------------------------------------------------------------------
  259.   def watch_at(x)
  260.     @watch_battler = nil
  261.     @x_destination =   x
  262.     @y_destination = 240
  263.     @z_destination = 185
  264.     set_speed
  265.   end
  266.   #--------------------------------------------------------------------------
  267.   # 仜 僘乕儉攞棪偺庢摼
  268.   #--------------------------------------------------------------------------
  269.   def zoom
  270.     return 185.00 / self.z
  271.   end
  272. end
  273. #==============================================================================
  274. # 仭 Game_Battler
  275. #==============================================================================
  276. class Game_Battler
  277.   #--------------------------------------------------------------------------
  278.   # 仜 岞奐僀儞僗僞儞僗曄悢
  279.   #--------------------------------------------------------------------------
  280.   attr_reader   :x                        # 僶僩儖僼傿乕儖僪丂墶丂埵抲(+偑塃丂)
  281.   attr_reader   :y                        # 僶僩儖僼傿乕儖僪 崅偝 埵抲(+偑壓丂)
  282.   attr_reader   :z                        # 僶僩儖僼傿乕儖僪墱峴偒埵抲(+偑庤慜)
  283.   #--------------------------------------------------------------------------
  284.   # 仜 僶僩儖僼傿乕儖僪忋偵嫃傞偐丠
  285.   #--------------------------------------------------------------------------
  286.   def in_battlefield?
  287.     return false
  288.   end
  289. end
  290. #==============================================================================
  291. # 仭 Game_Enemy
  292. #==============================================================================
  293. class Game_Enemy < Game_Battler
  294.   #--------------------------------------------------------------------------
  295.   # 仜 僶僩儖僼傿乕儖僪忋偵嫃傞偐丠 [僆乕僶乕儔僀僪]
  296.   #--------------------------------------------------------------------------
  297.   def in_battlefield?
  298.     return true
  299.   end
  300.   #--------------------------------------------------------------------------
  301.   # 仠 僆僽僕僃僋僩弶婜壔
  302.   #--------------------------------------------------------------------------
  303.   alias xrxs_bp8_initialize initialize
  304.   def initialize(troop_id, member_index)
  305.     @z = 0
  306.     xrxs_bp8_initialize(troop_id, member_index)
  307.   end
  308.   #--------------------------------------------------------------------------
  309.   # 仠 僶僩儖夋柺 X 嵗昗偺庢摼
  310.   #--------------------------------------------------------------------------
  311.   alias x screen_x
  312.   def screen_x
  313.     return self.x if $xcam == nil
  314.     return 320 + (self.x - $xcam.x) * 185 / $xcam.z
  315.   end
  316.   #--------------------------------------------------------------------------
  317.   # 仠 僶僩儖夋柺 Y 嵗昗偺庢摼
  318.   #--------------------------------------------------------------------------
  319.   alias y screen_y
  320.   def screen_y
  321.     return self.y if $xcam == nil
  322.     return 240 + (self.y - $xcam.y) * 185 / $xcam.z
  323.   end
  324. end
  325. #==============================================================================
  326. # 仭 Spriteset_Battle
  327. #==============================================================================
  328. class Spriteset_Battle
  329.   #--------------------------------------------------------------------------
  330.   # 仜 僼儗乕儉峏怴 (壜摦僇儊儔)
  331.   #--------------------------------------------------------------------------
  332.   def update_xcam
  333.     # 僇儊儔埵抲偑摦偄偨応崌
  334.     if $xcam.moved?
  335.       # 僇儊儔埵抲偐傜僘乕儉棪傪寁嶼
  336.       zoom = 185.00 / $xcam.z
  337.       w = XRXS_BP8::GA_W / 2
  338.       h = w * 3 / 4
  339.       # 攚宨偺愝掕峏怴
  340.       @battleback_sprite.zoom_x = zoom
  341.       @battleback_sprite.zoom_y = zoom
  342.       @battleback_sprite.x      = (320 - $xcam.x) * zoom - w * (zoom - 1)
  343.       @battleback_sprite.y      = (240 - $xcam.y) * zoom - h * (zoom - 1)
  344.     end
  345.   end
  346. end
  347. #==============================================================================
  348. # --- 僶僩儔乕僗僾儔僀僩丒壜摦僇儊儔揔梡 ---
  349. #==============================================================================
  350. module XRXS_Cam_Deal
  351.   def update
  352.     # 屇傃栠偡
  353.     super
  354.     # 僶僩儔乕偑僶僩儖僼傿乕儖僪偵偄側偄応崌偼廔椆
  355.     return if @battler == nil or not @battler.in_battlefield?
  356.     # 僌儔僼傿僢僋偑枹愝掕側応崌偼廔椆
  357.     return if self.bitmap == nil
  358.     # 僘乕儉棪偺曄峏 ( 僗僾儔僀僩嵗昗偺嵞愝掕偼尦偺儊僜僢僪偵擟偣傞 )
  359.     zoom = 1.00 * 185 / (185 - @battler.z)
  360.     self.zoom_x = zoom * $xcam.zoom
  361.     self.zoom_y = zoom * $xcam.zoom
  362.   end
  363. end
  364. class Sprite_Battler < RPG::Sprite
  365.   include XRXS_Cam_Deal
  366. end
  367. #==============================================================================
  368. # --- 僟儊乕僕僼僅儘乕 儌僕儏乕儖 ---
  369. #==============================================================================
  370. module XRXS_DamageFollow
  371.   def update
  372.     # 屇傃栠偡
  373.     super
  374.     # 僇儊儔偑懚嵼偟側偄応崌
  375.     return if $xcam == nil
  376.     # 僶僩儔乕偑 nil 傑偨偼僶僩儖僼傿乕儖僪偵偄側偄応崌
  377.     return if @battler == nil or not @battler.in_battlefield?
  378.     # 捈慜僇儊儔埵抲偐傜丄堏摦検傪嶼弌
  379.     x_moved = @last_cam_x == nil ? 0 : $xcam.x - @last_cam_x
  380.     y_moved = @last_cam_y == nil ? 0 : $xcam.y - @last_cam_y
  381.     # 僟儊乕僕僗僾儔僀僩攝楍偺嶌惉
  382.     damage_sprites  = [@_damage_sprite]
  383.     damage_sprites += @damage_sprites if @damage_sprites != nil
  384.     # 僇儊儔傪僼僅儘乕
  385.     for sprite in damage_sprites
  386.       next if sprite == nil
  387.       next if sprite.disposed?
  388.       sprite.x -= x_moved
  389.       sprite.y -= y_moved
  390.     end
  391.     # 捈慜僇儊儔埵抲偺曐帩
  392.     @last_cam_x = $xcam.x
  393.     @last_cam_y = $xcam.y
  394.   end
  395. end
  396. class Sprite_Battler < RPG::Sprite
  397.   include XRXS_DamageFollow
  398. end
  399. #==============================================================================
  400. # 仭 Scene_Battle
  401. #==============================================================================
  402. class Scene_Battle
  403.   #--------------------------------------------------------------------------
  404.   # 仠 儊僀儞張棟
  405.   #--------------------------------------------------------------------------
  406.   alias xrxs_bp8_main main
  407.   def main
  408.     # 壜摦僇儊儔偺惗惉
  409.     $xcam = XCam.new
  410.     # 栠偡
  411.     xrxs_bp8_main
  412.     # 壜摦僇儊儔偺夝曻
  413.     $xcam = nil
  414.   end
  415.   #--------------------------------------------------------------------------
  416.   # 仠 僼儗乕儉峏怴
  417.   #--------------------------------------------------------------------------
  418.   alias xrxs_bp8_update update
  419.   def update
  420.     # 壜摦僇儊儔偺僼儗乕儉峏怴
  421.     $xcam.update
  422.     # 屇傃栠偡
  423.     xrxs_bp8_update
  424.   end
  425. end
  426. #------------------------------------------------------------------------------
  427. #
  428. #    仱 Full-View 僔僗僥儉 仱
  429. #
  430. #==============================================================================
  431. # 仭 Spriteset_Battle
  432. #==============================================================================
  433. class Spriteset_Battle
  434.   #--------------------------------------------------------------------------
  435.   # 仠 僆僽僕僃僋僩弶婜壔
  436.   #--------------------------------------------------------------------------
  437.   alias xrxs_bp8_initialize initialize
  438.   def initialize
  439.     # 屇傃栠偡
  440.     xrxs_bp8_initialize
  441.     # 僌儔僼傿僢僋僗傾儗僀傪庢摼
  442.     # 價儏乕億乕僩 0 傪嶌惉
  443.     w = XRXS_BP8::GA_W
  444.     h = w * 3 / 4
  445.     x = 320 - w / 2
  446.     y = 240 - h / 2
  447.     @viewport0 = Viewport.new(x, y, w, h)
  448.     @viewport0.z  = 0
  449.     # 價儏乕億乕僩 1 偺愝掕傪曄峏
  450.     @viewport1.z += 1
  451.     @viewport1.rect.height = 480
  452.     # 僶僩儖僶僢僋僗僾儔僀僩傪嵞嶌惉 (價儏乕億乕僩 0 傪巊梡)
  453.     @battleback_sprite.dispose
  454.     @battleback_sprite = Sprite.new(@viewport0)
  455.     @battleback_name = ""
  456.     # 僶僩儖僶僢僋偺僼儗乕儉峏怴
  457.     update_battleback
  458.   end
  459.   #--------------------------------------------------------------------------
  460.   # 仠 夝曻
  461.   #--------------------------------------------------------------------------
  462.   alias xrxs_bp8_dispose dispose
  463.   def dispose
  464.     # 屇傃栠偡
  465.     xrxs_bp8_dispose
  466.     # 價儏乕億乕僩傪夝曻
  467.     @viewport0.dispose
  468.   end
  469.   #--------------------------------------------------------------------------
  470.   # 仠 僼儗乕儉峏怴
  471.   #--------------------------------------------------------------------------
  472.   alias xrxs_bp8_update update
  473.   def update
  474.     # 僼儗乕儉峏怴 (僶僩儖僶僢僋)
  475.     update_battleback
  476.     # 僼儗乕儉峏怴 (壜摦僇儊儔)
  477.     update_xcam if defined? update_xcam
  478.     # 屇傃栠偡
  479.     xrxs_bp8_update
  480.     # 夋柺偺僔僃僀僋埵抲傪愝掕
  481.     @viewport0.ox = $game_screen.shake if @viewport0 != nil
  482. ####################################################

  483.       switches = 1 #开关控制
  484.       update_speed = 10 #图片循环的速度
  485.       battle_background = [ #循环播放的图片
  486.       "002-Woods01", "003-Forest01", "005-Beach01",
  487.       ]

  488.       # 僌儔僼傿僢僋僗傾儗僀傪庢摼
  489.       w = XRXS_BP8::GA_W
  490.       h = w * 3 / 4
  491.       # 僶僩儖僶僢僋偺庢摼偲奼戝
  492.       @battleback_update_count ||= 0
  493.       @battleback_update_count += 1
  494.       @battleback_update_count = 0 if @battleback_update_count >= battle_background.length*update_speed

  495.       bg   = RPG::Cache.battleback(battle_background[@battleback_update_count/update_speed])
  496.       @xga  ||= Bitmap.new(w, h)
  497.       @xga.stretch_blt(@xga.rect, bg, bg.rect)

  498.       # XGA傪僶僩儖僶僢僋偵愝掕
  499.       @battleback_sprite.bitmap = @xga if $game_switches[switches]
  500. ####################################################
  501.   end
  502.   #--------------------------------------------------------------------------
  503.   # 仜 僼儗乕儉峏怴 (僶僩儖僶僢僋)
  504.   #--------------------------------------------------------------------------
  505.   def update_battleback
  506.     # 僶僩儖僶僢僋偺僼傽僀儖柤偑尰嵼偺傕偺偲堘偆応崌
  507.     if @battleback_name != $game_temp.battleback_name
  508.       @battleback_name = $game_temp.battleback_name
  509.       if @battleback_sprite.bitmap != nil
  510.         @battleback_sprite.bitmap.dispose
  511.       end
  512.       # 僌儔僼傿僢僋僗傾儗僀傪庢摼
  513.       w = XRXS_BP8::GA_W
  514.       h = w * 3 / 4
  515.       # 僶僩儖僶僢僋偺庢摼偲奼戝
  516.       bg   = RPG::Cache.battleback(@battleback_name)
  517.       xga  = Bitmap.new(w, h)
  518.       xga.stretch_blt(xga.rect, bg, bg.rect)
  519.       # XGA傪僶僩儖僶僢僋偵愝掕
  520.       @battleback_sprite.bitmap = xga
  521.     end
  522.   end
  523. end
  524. #==============================================================================
  525. # ---乽愴摤拞偺"夋柺"傾僯儊偺埵抲廋惓乿儌僕儏乕儖 ---
  526. #==============================================================================
  527. module XRXS_FullScreen_AnimationOffset
  528.   def animation_set_sprites(sprites, cell_data, position)
  529.     super
  530.     for i in 0..15
  531.       sprite = sprites[i]
  532.       pattern = cell_data[i, 0]
  533.       if sprite == nil or pattern == nil or pattern == -1
  534.         next
  535.       end
  536.       if position == 3
  537.         if self.viewport != nil
  538.           sprite.y = 160 # 偙偺堦峴偩偗曄峏
  539.           sprite.y += cell_data[i, 2]
  540.         end
  541.       end
  542.     end
  543.   end
  544. end
  545. class Sprite_Battler < RPG::Sprite
  546.   include XRXS_FullScreen_AnimationOffset
  547. end
复制代码


评分

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

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-21 18:39

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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