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

Project1

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

[已经解决] 请问如何修改地图上显示动画的Z值

[复制链接]

Lv1.梦旅人

梦石
0
星屑
102
在线时间
12 小时
注册时间
2019-3-21
帖子
5
跳转到指定楼层
1
发表于 2019-3-21 19:42:26 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我全程用的是图片显示背景,然后对事件使用的动画,图片会把动画挡住?请问怎么修改啊T T

Lv4.逐梦者

梦石
1
星屑
14504
在线时间
2086 小时
注册时间
2017-9-28
帖子
662
2
发表于 2019-3-21 21:08:36 | 只看该作者
  1. #==============================================================================
  2. # TheoAllen - 在图片上显示动画
  3. # Version: 1.0
  4. # Contact: Discord @ Theo#3034
  5. #==============================================================================
  6. ($imported ||= {})[:Theo_AnimationOverPic] = true
  7. #==============================================================================
  8. # Change Logs:
  9. # -----------------------------------------------------------------------------
  10. # 2018.03.03 - Translated to eng
  11. # 2013.10.27 - Finished
  12. #==============================================================================
  13. %Q{

  14.   =================
  15.   || 说明 ||
  16.   -----------------
  17.   你要被“动画只能显示在图片背后”烦死了吗?
  18.   用这个脚本吧
  19.   
  20.   ======================
  21.   || 使用方法 ||
  22.   ----------------------
  23.   使用脚本:
  24.   
  25.   anim_pic(图片编号, 动画id)
  26.   
  27.   ===================
  28.   || Terms of use ||
  29.   -------------------
  30.   > Free to edit / Repost of edit
  31.   > Free for commercial / non-commercial / contest with prize
  32.   > Credit is not required, but don't claim it's yours
  33.   
  34. }
  35. #==============================================================================
  36. # Tidak ada konfigurasi
  37. #==============================================================================
  38. #==============================================================================
  39. # * Game_Interpreter
  40. #==============================================================================
  41. class Game_Interpreter
  42.   
  43.   def anim_pic(pic_num, anim_id, mirror = false)
  44.     if $game_party.in_battle
  45.       pic = $game_troop.screen.pictures[pic_num]
  46.     else
  47.       pic = $game_map.screen.pictures[pic_num]
  48.     end
  49.     pic.anim_id = anim_id
  50.     pic.anim_mirror = mirror
  51.   end
  52.   
  53. end

  54. #==============================================================================
  55. # * Game_Picture
  56. #==============================================================================

  57. class Game_Picture
  58.   attr_accessor :anim_id
  59.   attr_accessor :anim_mirror
  60.   
  61.   alias theo_animpic_init initialize
  62.   def initialize(number)
  63.     theo_animpic_init(number)
  64.     @anim_id = 0
  65.     @anim_mirror = false
  66.   end
  67.   
  68. end

  69. #==============================================================================
  70. # * Sprite_Picture
  71. #==============================================================================

  72. class Sprite_Picture
  73.   
  74.   @@ani_checker = []
  75.   @@ani_spr_checker = []
  76.   @@_reference_count = {}
  77.   
  78.   alias theo_animpic_dispose dispose
  79.   def dispose
  80.     theo_animpic_dispose
  81.     dispose_animation
  82.   end
  83.   
  84.   alias theo_animpic_update update
  85.   def update
  86.     theo_animpic_update
  87.     update_animation
  88.     @@ani_checker.clear
  89.     @@ani_spr_checker.clear
  90.     update_anim_flag
  91.   end
  92.   
  93.   def update_anim_flag
  94.     if @picture.anim_id > 0
  95.       start_animation($data_animations[@picture.anim_id], @picture.anim_mirror)
  96.       @picture.anim_id = 0
  97.     end
  98.   end
  99.   
  100.   def animation?
  101.     @animation != nil
  102.   end
  103.   
  104.   def start_animation(animation, mirror = false)
  105.     dispose_animation
  106.     @animation = animation
  107.     if @animation
  108.       @ani_mirror = mirror
  109.       set_animation_rate
  110.       @ani_duration = @animation.frame_max * @ani_rate + 1
  111.       load_animation_bitmap
  112.       make_animation_sprites
  113.       set_animation_origin
  114.     end
  115.   end
  116.   
  117.   def set_animation_rate
  118.     @ani_rate = 4     # Fixed value by default
  119.     @ani_rate = YEA::CORE::ANIMATION_RATE if $imported["YEA-CoreEngine"]
  120.   end
  121.   
  122.   def load_animation_bitmap
  123.     animation1_name = @animation.animation1_name
  124.     animation1_hue = @animation.animation1_hue
  125.     animation2_name = @animation.animation2_name
  126.     animation2_hue = @animation.animation2_hue
  127.     @ani_bitmap1 = Cache.animation(animation1_name, animation1_hue)
  128.     @ani_bitmap2 = Cache.animation(animation2_name, animation2_hue)
  129.     if @@_reference_count.include?(@ani_bitmap1)
  130.       @@_reference_count[@ani_bitmap1] += 1
  131.     else
  132.       @@_reference_count[@ani_bitmap1] = 1
  133.     end
  134.     if @@_reference_count.include?(@ani_bitmap2)
  135.       @@_reference_count[@ani_bitmap2] += 1
  136.     else
  137.       @@_reference_count[@ani_bitmap2] = 1
  138.     end
  139.     Graphics.frame_reset
  140.   end
  141.   
  142.   def make_animation_sprites
  143.     @ani_sprites = []
  144.     if !@@ani_spr_checker.include?(@animation)
  145.       16.times do
  146.         sprite = ::Sprite.new(viewport)
  147.         sprite.visible = false
  148.         @ani_sprites.push(sprite)
  149.       end
  150.       if @animation.position == 3
  151.         @@ani_spr_checker.push(@animation)
  152.       end
  153.     end
  154.     @ani_duplicated = @@ani_checker.include?(@animation)
  155.     if !@ani_duplicated && @animation.position == 3
  156.       @@ani_checker.push(@animation)
  157.     end
  158.   end
  159.   
  160.   def set_animation_origin
  161.     if @animation.position == 3
  162.       if viewport == nil
  163.         @ani_ox = Graphics.width / 2
  164.         @ani_oy = Graphics.height / 2
  165.       else
  166.         @ani_ox = viewport.rect.width / 2
  167.         @ani_oy = viewport.rect.height / 2
  168.       end
  169.     else
  170.       @ani_ox = x - ox + width / 2
  171.       @ani_oy = y - oy + height / 2
  172.       if @animation.position == 0
  173.         @ani_oy -= height / 2
  174.       elsif @animation.position == 2
  175.         @ani_oy += height / 2
  176.       end
  177.     end
  178.   end
  179.   
  180.   def dispose_animation
  181.     if @ani_bitmap1
  182.       @@_reference_count[@ani_bitmap1] -= 1
  183.       if @@_reference_count[@ani_bitmap1] == 0
  184.         @ani_bitmap1.dispose
  185.       end
  186.     end
  187.     if @ani_bitmap2
  188.       @@_reference_count[@ani_bitmap2] -= 1
  189.       if @@_reference_count[@ani_bitmap2] == 0
  190.         @ani_bitmap2.dispose
  191.       end
  192.     end
  193.     if @ani_sprites
  194.       @ani_sprites.each {|sprite| sprite.dispose }
  195.       @ani_sprites = nil
  196.       @animation = nil
  197.     end
  198.     @ani_bitmap1 = nil
  199.     @ani_bitmap2 = nil
  200.   end
  201.   
  202.   def update_animation
  203.     return unless animation?
  204.     @ani_duration -= 1
  205.     if @ani_duration % @ani_rate == 0
  206.       if @ani_duration > 0
  207.         frame_index = @animation.frame_max
  208.         frame_index -= (@ani_duration + @ani_rate - 1) / @ani_rate
  209.         animation_set_sprites(@animation.frames[frame_index])
  210.         @animation.timings.each do |timing|
  211.           animation_process_timing(timing) if timing.frame == frame_index
  212.         end
  213.       else
  214.         end_animation
  215.       end
  216.     end
  217.   end
  218.   
  219.   def end_animation
  220.     dispose_animation
  221.   end
  222.   
  223.   def animation_set_sprites(frame)
  224.     cell_data = frame.cell_data
  225.     @ani_sprites.each_with_index do |sprite, i|
  226.       next unless sprite
  227.       pattern = cell_data[i, 0]
  228.       if !pattern || pattern < 0
  229.         sprite.visible = false
  230.         next
  231.       end
  232.       sprite.bitmap = pattern < 100 ? @ani_bitmap1 : @ani_bitmap2
  233.       sprite.visible = true
  234.       sprite.src_rect.set(pattern % 5 * 192,
  235.         pattern % 100 / 5 * 192, 192, 192)
  236.       if @ani_mirror
  237.         sprite.x = @ani_ox - cell_data[i, 1]
  238.         sprite.y = @ani_oy + cell_data[i, 2]
  239.         sprite.angle = (360 - cell_data[i, 4])
  240.         sprite.mirror = (cell_data[i, 5] == 0)
  241.       else
  242.         sprite.x = @ani_ox + cell_data[i, 1]
  243.         sprite.y = @ani_oy + cell_data[i, 2]
  244.         sprite.angle = cell_data[i, 4]
  245.         sprite.mirror = (cell_data[i, 5] == 1)
  246.       end
  247.       sprite.z = self.z + 300 + i
  248.       sprite.ox = 96
  249.       sprite.oy = 96
  250.       sprite.zoom_x = cell_data[i, 3] / 100.0
  251.       sprite.zoom_y = cell_data[i, 3] / 100.0
  252.       sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  253.       sprite.blend_type = cell_data[i, 7]
  254.     end
  255.   end
  256.   
  257.   def animation_process_timing(timing)
  258.     timing.se.play unless @ani_duplicated
  259.     case timing.flash_scope
  260.     when 1
  261.       self.flash(timing.flash_color, timing.flash_duration * @ani_rate)
  262.     when 2
  263.       if viewport && !@ani_duplicated
  264.         viewport.flash(timing.flash_color, timing.flash_duration * @ani_rate)
  265.       end
  266.     when 3
  267.       self.flash(nil, timing.flash_duration * @ani_rate)
  268.     end
  269.   end
  270. end
复制代码

评分

参与人数 2星屑 +100 +1 收起 理由
VIPArcher + 100 认可答案
小转子 + 1 认可答案

查看全部评分

VA外站脚本汉化群:226308173   |    部分远古文件备份:https://wwzv.lanzoue.com/b02rac5pc  密码:acgm
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
102
在线时间
12 小时
注册时间
2019-3-21
帖子
5
3
 楼主| 发表于 2019-3-24 00:15:45 | 只看该作者

就直接插入main之上就可以了吗? 这个原理是什么?我以为改一下Z值就好了呢
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
102
在线时间
12 小时
注册时间
2019-3-21
帖子
5
4
 楼主| 发表于 2019-3-24 00:25:16 | 只看该作者
本帖最后由 小转子 于 2019-3-24 00:27 编辑


这个脚本是不是只能显示对画面的动画我设置的动画是对事件使用的

脚本挺好的,但是我如果想用死办法强行修改所有动画的Z值呢0.0

请教。。。
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-25 11:37

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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