查看: 1716|回复: 1

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

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

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

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

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


  [pre lang="ruby"]=begin
      RGSS3
      
   ★ 古の光 ★

      天候と同じように利用できる演出素材です。
      
      ● 準備 ●==========================================================
      「Graphics\System\」に下記の2ファイルを入れます
       ancient_00.png
       ancient_01.png
      ====================================================================
      
      ● エフェクトの開始 ●==============================================
      イベントコマンドで次のスクリプトを実行します
      --------------------------------------------------------------------
      ancient_light
      ====================================================================
      
      ● エフェクトの終了 ●==============================================
      イベントコマンドの「天候の設定」で「なし」を実行します
      ====================================================================
      
      ver1.00
      
      Last Update : 2015/03/19
      3/19 : 新規
      
      ろかん   http://kaisou-ryouiki.sakura.ne.jp/
=end

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

class Game_Interpreter
  #--------------------------------------------------------------------------
  # ● 天候:舞い上がる光の開始
  #--------------------------------------------------------------------------
  def ancient_light
    screen.change_weather(:ancient_light, 3, 0)
  end
end

class Spriteset_Weather
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_reader   :viewport
  attr_reader   :sprites
  #--------------------------------------------------------------------------
  # ● 天候の種類を設定
  #--------------------------------------------------------------------------
  def type=(type)
    if @type != type
      @sprites.each{|sprite| sprite.dispose}
      @sprites = []
      if type == :ancient_light
        5.times{@sprites << Ancient_Light.new(self)}
      end
    end
    @type = type
  end
  #--------------------------------------------------------------------------
  # ● 天候の強さを設定
  #--------------------------------------------------------------------------
  alias ancient_light_power= power=
  def power=(power)
    if @type != :ancient_light
      self.ancient_light_power = power
    else
      @power = power
    end
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  alias ancient_light_update update
  def update
    if @type == :ancient_light
      update_screen
      @sprites << Ancient_Light.new(self) if (Graphics.frame_count % 100).zero?
      @sprites.each{|sprite| sprite.update}
    else
      ancient_light_update
    end
  end
end

class Ancient_Light
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(owner)
    @owner = owner
    @exist_counter = 1200
    @origin_ox = @owner.ox
    @origin_oy = @owner.oy
    @x = rand(Graphics.width + 192) - 96
    @y = rand(Graphics.height + 192) - 96
    @angle_speed = rand(7) / 10.0 * (rand(2).zero? ? 1 : -1)
    @vector_x = rand(2).zero? ? 1 : -1
    @vector_y = rand(2).zero? ? 1 : -1
    create_sprite
  end
  #--------------------------------------------------------------------------
  # ● スプライトの生成
  #--------------------------------------------------------------------------
  def create_sprite
    @sprites = [Sprite.new(@owner.viewport), Sprite.new(@owner.viewport)]
    @sprites[0].bitmap = Cache.system("ancient_00")
    @sprites[1].bitmap = Cache.system("ancient_01")
    @sprites[0].blend_type = @sprites[1].blend_type = 1
    @sprites[0].angle = @sprites[1].angle = rand(360)
    @sprites[0].ox = @sprites[1].ox = @sprites[0].bitmap.width / 2
    @sprites[0].oy = @sprites[1].oy = @sprites[0].bitmap.height / 2
    @sprites[0].x = @sprites[1].x = @x + (@origin_ox - @owner.ox)
    @sprites[0].y = @sprites[1].y = @y + (@origin_oy - @owner.oy)
    @sprites[0].z = rand(2)
    @sprites[0].zoom_x = rand(11).next / 10.0 - 0.3
    @sprites[0].zoom_y = rand(11).next / 10.0 - 0.3
    @sprites[1].zoom_x = [0.2, @sprites[0].zoom_x].max
    @sprites[1].zoom_y = [0.2, @sprites[0].zoom_y].max
    @sprites[0].opacity = @sprites[1].opacity = 0
  end
  #--------------------------------------------------------------------------
  # ● X 軸方向の速度を取得
  #--------------------------------------------------------------------------
  def x_speed
    (@sprites[0].zoom_x + @sprites[0].zoom_y) / 3.0 * @vector_x
  end
  #--------------------------------------------------------------------------
  # ● Y 軸方向の速度を取得
  #--------------------------------------------------------------------------
  def y_speed
    x_speed / 2.0 * @vector_y
  end
  #--------------------------------------------------------------------------
  # ● 解放
  #--------------------------------------------------------------------------
  def dispose
    @sprites[0].dispose
    @sprites[1].dispose
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    case @exist_counter
    when 1141..1200
      @sprites[0].zoom_x += 0.005
      @sprites[0].zoom_y += 0.005
      @sprites[1].zoom_x += 0.005
      @sprites[1].zoom_y += 0.005
      @sprites[0].opacity = @sprites[1].opacity += 5
    else
      if (Graphics.frame_count % 2).zero?
        @sprites[0].opacity = @sprites[1].opacity = @exist_counter
        @sprites[1].opacity -= rand(200)
        @sprites[0].angle = @sprites[1].angle += @angle_speed
      end
    end
    @x += x_speed
    @y += y_speed
    @sprites[0].x = @sprites[1].x = @x.to_i + (@origin_ox - @owner.ox)
    @sprites[0].y = @sprites[1].y = @y.to_i + (@origin_oy - @owner.oy)
    @exist_counter -= 1
    if @exist_counter.zero?
      dispose
      @owner.sprites.delete(self)
    else
      out_screen_process
    end
  end
  #--------------------------------------------------------------------------
  # ● 画面外に出た場合の処理(ループさせて画面内に戻す)
  #--------------------------------------------------------------------------
  def out_screen_process
    if @sprites[0].x < -96
      while @sprites[0].x < -96
        @sprites[0].x = @sprites[1].x += Graphics.width + 192
      end
    elsif @sprites[0].x > Graphics.width + 96
      while @sprites[0].x > Graphics.width + 96
        @sprites[0].x = @sprites[1].x -= Graphics.width + 192
      end
    end
    if @sprites[0].y < -96
      while @sprites[0].y < -96
        @sprites[0].y = @sprites[1].y += Graphics.height + 192
      end
    elsif @sprites[0].y > Graphics.height + 96
      while @sprites[0].y > Graphics.height + 96
        @sprites[0].y = @sprites[1].y -= Graphics.height + 192
      end
    end
  end
end[/pre]

店长

梦石
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.

在本版发帖返回顶部