查看: 1759|回复: 1

[已经解决] 这个光效脚本怎么停止

[复制链接]
梦石
0
星屑
163
在线时间
445 小时
注册时间
2013-7-18
回帖
90
发表于 2015-12-15 07:04:39 | 显示全部楼层 |阅读模式

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

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

×
出自回想領域,效果很漂亮。
光效开启脚本是    ancient_light
但是怎么关闭呢?把xx值设定为false ??  日文看不懂。
这个只是简单的问问,过几天再发有偿帖子,欢迎帮忙。


  1. =begin
  2.       RGSS3
  3.       
  4.    ★ 古の光 ★

  5.       天候と同じように利用できる演出素材です。
  6.       
  7.       ● 準備 ●==========================================================
  8.       「Graphics\System\」に下記の2ファイルを入れます
  9.        ancient_00.png
  10.        ancient_01.png
  11.       ====================================================================
  12.       
  13.       ● エフェクトの開始 ●==============================================
  14.       イベントコマンドで次のスクリプトを実行します
  15.       --------------------------------------------------------------------
  16.       ancient_light
  17.       ====================================================================
  18.       
  19.       ● エフェクトの終了 ●==============================================
  20.       イベントコマンドの「天候の設定」で「なし」を実行します
  21.       ====================================================================
  22.       
  23.       ver1.00
  24.       
  25.       Last Update : 2015/03/19
  26.       3/19 : 新規
  27.       
  28.       ろかん   [url]http://kaisou-ryouiki.sakura.ne.jp/[/url]
  29. =end

  30. $rsi ||= {}
  31. $rsi["古の光"] = true

  32. class Game_Interpreter
  33.   #--------------------------------------------------------------------------
  34.   # ● 天候:舞い上がる光の開始
  35.   #--------------------------------------------------------------------------
  36.   def ancient_light
  37.     screen.change_weather(:ancient_light, 3, 0)
  38.   end
  39. end

  40. class Spriteset_Weather
  41.   #--------------------------------------------------------------------------
  42.   # ● 公開インスタンス変数
  43.   #--------------------------------------------------------------------------
  44.   attr_reader   :viewport
  45.   attr_reader   :sprites
  46.   #--------------------------------------------------------------------------
  47.   # ● 天候の種類を設定
  48.   #--------------------------------------------------------------------------
  49.   def type=(type)
  50.     if @type != type
  51.       @sprites.each{|sprite| sprite.dispose}
  52.       @sprites = []
  53.       if type == :ancient_light
  54.         5.times{@sprites << Ancient_Light.new(self)}
  55.       end
  56.     end
  57.     @type = type
  58.   end
  59.   #--------------------------------------------------------------------------
  60.   # ● 天候の強さを設定
  61.   #--------------------------------------------------------------------------
  62.   alias ancient_light_power= power=
  63.   def power=(power)
  64.     if @type != :ancient_light
  65.       self.ancient_light_power = power
  66.     else
  67.       @power = power
  68.     end
  69.   end
  70.   #--------------------------------------------------------------------------
  71.   # ● フレーム更新
  72.   #--------------------------------------------------------------------------
  73.   alias ancient_light_update update
  74.   def update
  75.     if @type == :ancient_light
  76.       update_screen
  77.       @sprites << Ancient_Light.new(self) if (Graphics.frame_count % 100).zero?
  78.       @sprites.each{|sprite| sprite.update}
  79.     else
  80.       ancient_light_update
  81.     end
  82.   end
  83. end

  84. class Ancient_Light
  85.   #--------------------------------------------------------------------------
  86.   # ● オブジェクト初期化
  87.   #--------------------------------------------------------------------------
  88.   def initialize(owner)
  89.     @owner = owner
  90.     @exist_counter = 1200
  91.     @origin_ox = @owner.ox
  92.     @origin_oy = @owner.oy
  93.     @x = rand(Graphics.width + 192) - 96
  94.     @y = rand(Graphics.height + 192) - 96
  95.     @angle_speed = rand(7) / 10.0 * (rand(2).zero? ? 1 : -1)
  96.     @vector_x = rand(2).zero? ? 1 : -1
  97.     @vector_y = rand(2).zero? ? 1 : -1
  98.     create_sprite
  99.   end
  100.   #--------------------------------------------------------------------------
  101.   # ● スプライトの生成
  102.   #--------------------------------------------------------------------------
  103.   def create_sprite
  104.     @sprites = [Sprite.new(@owner.viewport), Sprite.new(@owner.viewport)]
  105.     @sprites[0].bitmap = Cache.system("ancient_00")
  106.     @sprites[1].bitmap = Cache.system("ancient_01")
  107.     @sprites[0].blend_type = @sprites[1].blend_type = 1
  108.     @sprites[0].angle = @sprites[1].angle = rand(360)
  109.     @sprites[0].ox = @sprites[1].ox = @sprites[0].bitmap.width / 2
  110.     @sprites[0].oy = @sprites[1].oy = @sprites[0].bitmap.height / 2
  111.     @sprites[0].x = @sprites[1].x = @x + (@origin_ox - @owner.ox)
  112.     @sprites[0].y = @sprites[1].y = @y + (@origin_oy - @owner.oy)
  113.     @sprites[0].z = rand(2)
  114.     @sprites[0].zoom_x = rand(11).next / 10.0 - 0.3
  115.     @sprites[0].zoom_y = rand(11).next / 10.0 - 0.3
  116.     @sprites[1].zoom_x = [0.2, @sprites[0].zoom_x].max
  117.     @sprites[1].zoom_y = [0.2, @sprites[0].zoom_y].max
  118.     @sprites[0].opacity = @sprites[1].opacity = 0
  119.   end
  120.   #--------------------------------------------------------------------------
  121.   # ● X 軸方向の速度を取得
  122.   #--------------------------------------------------------------------------
  123.   def x_speed
  124.     (@sprites[0].zoom_x + @sprites[0].zoom_y) / 3.0 * @vector_x
  125.   end
  126.   #--------------------------------------------------------------------------
  127.   # ● Y 軸方向の速度を取得
  128.   #--------------------------------------------------------------------------
  129.   def y_speed
  130.     x_speed / 2.0 * @vector_y
  131.   end
  132.   #--------------------------------------------------------------------------
  133.   # ● 解放
  134.   #--------------------------------------------------------------------------
  135.   def dispose
  136.     @sprites[0].dispose
  137.     @sprites[1].dispose
  138.   end
  139.   #--------------------------------------------------------------------------
  140.   # ● フレーム更新
  141.   #--------------------------------------------------------------------------
  142.   def update
  143.     case @exist_counter
  144.     when 1141..1200
  145.       @sprites[0].zoom_x += 0.005
  146.       @sprites[0].zoom_y += 0.005
  147.       @sprites[1].zoom_x += 0.005
  148.       @sprites[1].zoom_y += 0.005
  149.       @sprites[0].opacity = @sprites[1].opacity += 5
  150.     else
  151.       if (Graphics.frame_count % 2).zero?
  152.         @sprites[0].opacity = @sprites[1].opacity = @exist_counter
  153.         @sprites[1].opacity -= rand(200)
  154.         @sprites[0].angle = @sprites[1].angle += @angle_speed
  155.       end
  156.     end
  157.     @x += x_speed
  158.     @y += y_speed
  159.     @sprites[0].x = @sprites[1].x = @x.to_i + (@origin_ox - @owner.ox)
  160.     @sprites[0].y = @sprites[1].y = @y.to_i + (@origin_oy - @owner.oy)
  161.     @exist_counter -= 1
  162.     if @exist_counter.zero?
  163.       dispose
  164.       @owner.sprites.delete(self)
  165.     else
  166.       out_screen_process
  167.     end
  168.   end
  169.   #--------------------------------------------------------------------------
  170.   # ● 画面外に出た場合の処理(ループさせて画面内に戻す)
  171.   #--------------------------------------------------------------------------
  172.   def out_screen_process
  173.     if @sprites[0].x < -96
  174.       while @sprites[0].x < -96
  175.         @sprites[0].x = @sprites[1].x += Graphics.width + 192
  176.       end
  177.     elsif @sprites[0].x > Graphics.width + 96
  178.       while @sprites[0].x > Graphics.width + 96
  179.         @sprites[0].x = @sprites[1].x -= Graphics.width + 192
  180.       end
  181.     end
  182.     if @sprites[0].y < -96
  183.       while @sprites[0].y < -96
  184.         @sprites[0].y = @sprites[1].y += Graphics.height + 192
  185.       end
  186.     elsif @sprites[0].y > Graphics.height + 96
  187.       while @sprites[0].y > Graphics.height + 96
  188.         @sprites[0].y = @sprites[1].y -= Graphics.height + 192
  189.       end
  190.     end
  191.   end
  192. end
复制代码

店长

梦石
13
星屑
1282
在线时间
1810 小时
注册时间
2010-10-6
回帖
760

蛤蛤蛤蛤开拓者

发表于 2015-12-15 07:32:54 | 显示全部楼层
在事件指令中的设置天气效果里选择“无”

评分

参与人数 2星屑 +210 收起 理由
lottesong + 10 谢谢你!^^
taroxd + 200 认可答案

查看全部评分

努力填新坑中!
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部