1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
| =begin
RGSS3
★ スクリーンノイズ ★
ゲーム画面に古い映像フィルムのようなノイズ効果を与えます。
天候と似た使い方を想定しています。
Pour utiliser ce script, utilisez les indicatifs ci-dessous.
Dans un évènement, insérz un script.
● コマンド一覧 ●==================================================
start_noise -> Pour débuter l'effet.
--------------------------------------------------------------------
ノイズエフェクトの開始。
====================================================================
end_noise -> Pour mettre fin à l'effet.
--------------------------------------------------------------------
ノイズエフェクトの終了。
====================================================================
ver1.00
Last Update : 2011/12/17
12/17 : RGSS2からの移植
ろかん http://kaisou-ryouiki.sakura.ne.jp/
=end
$rsi ||= {}
$rsi["スクリーンノイズ"] = true
class Game_Temp
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :r_noise_effect_spriteset # ノイズスプライトセットへの参照
#--------------------------------------------------------------------------
# ● ノイズの開始
#--------------------------------------------------------------------------
def start_noise
@r_noise_effect_spriteset.start_noise
end
#--------------------------------------------------------------------------
# ● ノイズの終了
#--------------------------------------------------------------------------
def end_noise
@r_noise_effect_spriteset.end_noise
end
end
class Game_System
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :r_noise_effect # ノイズエフェクト表示中判定
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias r_noise_effect_initialize initialize
def initialize
r_noise_effect_initialize
@r_noise_effect = false
end
#--------------------------------------------------------------------------
# ● ノイズの開始
#--------------------------------------------------------------------------
def start_noise
$game_temp.start_noise
@r_noise_effect = true
end
#--------------------------------------------------------------------------
# ● ノイズの終了
#--------------------------------------------------------------------------
def end_noise
$game_temp.end_noise
@r_noise_effect = false
end
end
class Game_Interpreter
#--------------------------------------------------------------------------
# ● ノイズの開始
#--------------------------------------------------------------------------
def start_noise
$game_system.start_noise
end
#--------------------------------------------------------------------------
# ● ノイズの終了
#--------------------------------------------------------------------------
def end_noise
$game_system.end_noise
end
end
class NoiseBase_Sprite < Sprite
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(viewport)
super(viewport)
self.bitmap = Cache.system("noise_base")
self.visible = false
self.blend_type = 1
@blink = true
update
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
self.x = -(rand(self.bitmap.width - 544))
self.opacity = @blink ? 230 : 255
@blink ^= true
end
end
class NoiseLine_Sprite < Sprite
VX = [-2, -1, -1, 0, 1, 1, 2]
OS = [-50, -20, -10, 0, 10, 20, 30, 50]
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(viewport, start_x)
super(viewport)
self.bitmap = Cache.system("noise_line")
self.visible = false
self.x = start_x
@vector_x = VX[rand(VX.size)]
@opacity_speed = OS[rand(OS.size)]
update
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
self.x = [[self.x + @vector_x, 0].max, 544].min
self.y = -(rand(self.bitmap.height - 416))
self.opacity += @opacity_speed
@vector_x = VX[rand(VX.size)] if rand(6).zero?
@opacity_speed = OS[rand(OS.size)] if rand(6).zero?
end
end
class NoiseDot_Sprite < Sprite
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(viewport)
super(viewport)
self.bitmap = Cache.system("noise_dot")
self.visible = false
update
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
if rand(50).zero?
self.zoom_x = rand(100).next / 100.0
self.zoom_y = rand(100).next / 100.0
self.angle = rand(360)
self.x = rand(544)
self.y = rand(416)
self.opacity = 255
else
self.opacity = 0
end
end
end
class Spriteset_Noise
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
create_noise
start_noise if $game_system.r_noise_effect
end
#--------------------------------------------------------------------------
# ● ノイズの生成
#--------------------------------------------------------------------------
def create_noise
@viewport_base = Viewport.new(0, 0, 544, 416)
@viewport_line = Viewport.new(0, 0, 544, 416)
@viewport_dot = Viewport.new(0, 0, 544, 416)
@viewport_base.z = 90
@viewport_line.z = @viewport_base.z.next
@viewport_dot.z = @viewport_line.z.next
@base_sprite = NoiseBase_Sprite.new(@viewport_base)
@line_sprites = []
@line_sprites << NoiseLine_Sprite.new(@viewport_line, 50)
@line_sprites << NoiseLine_Sprite.new(@viewport_line, 350)
@line_sprites << NoiseLine_Sprite.new(@viewport_line, 400)
@line_sprites << NoiseLine_Sprite.new(@viewport_line, 500)
@dot_sprite = NoiseDot_Sprite.new(@viewport_dot)
end
#--------------------------------------------------------------------------
# ● ノイズの解放
#--------------------------------------------------------------------------
def dispose_noise
@base_sprite.dispose
@line_sprites.each{|sprite| sprite.dispose}
@dot_sprite.dispose
end
#--------------------------------------------------------------------------
# ● ノイズの開始
#--------------------------------------------------------------------------
def start_noise
@base_sprite.visible = true
@line_sprites.each{|sprite| sprite.visible = true}
@dot_sprite.visible = true
end
#--------------------------------------------------------------------------
# ● ノイズの終了
#--------------------------------------------------------------------------
def end_noise
@base_sprite.visible = false
@line_sprites.each{|sprite| sprite.visible = false}
@dot_sprite.visible = false
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
if $game_system.r_noise_effect && (Graphics.frame_count % 3).zero?
@base_sprite.update
@line_sprites.each{|sprite| sprite.update}
@dot_sprite.update
end
end
end
class Spriteset_Map
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias r_noise_effect_initialize initialize
def initialize
@r_noise_effect_set = Spriteset_Noise.new
$game_temp.r_noise_effect_spriteset = @r_noise_effect_set
r_noise_effect_initialize
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
alias r_noise_effect_dispose dispose
def dispose
r_noise_effect_dispose
@r_noise_effect_set.dispose_noise
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias r_noise_effect_update update
def update
r_noise_effect_update
update_noise_effect
end
#--------------------------------------------------------------------------
# ● スクリーンノイズの更新
#--------------------------------------------------------------------------
def update_noise_effect
@r_noise_effect_set.update
end
end |