Game_Screen

Publié le par chindan

#============================================
# ¡ Game_Screen
#--------------------------------------------
# @F’²•ύX‚âƒtƒ‰ƒbƒVƒ…‚ȂǁA‰æ–Ê‘S‘̂Ɋ֌W‚·‚鏈—‚̃f[ƒ^‚ð•ێ‚·‚éƒNƒ‰ƒX‚Å
# ‚·B‚±‚̃Nƒ‰ƒX‚̃Cƒ“ƒXƒ^ƒ“ƒX‚Í $game_screen ‚ŎQÆ‚³‚ê‚Ü‚·B
#============================================

class Game_Screen
#------------------------------------------
# œ ŒöŠJƒCƒ“ƒXƒ^ƒ“ƒX•ϐ”
#------------------------------------------
attr_reader :tone # F’²
attr_reader :flash_color # ƒtƒ‰ƒbƒVƒ…F
attr_reader :shake # ƒVƒFƒCƒNˆÊ’u
attr_reader :pictures # ƒsƒNƒ`ƒƒ
attr_reader :weather_type # “VŒó ƒ^ƒCƒv
attr_reader :weather_max # “VŒó ‰æ‘œ‚̍ő吔
#------------------------------------------
# œ ƒIƒuƒWƒFƒNƒg‰Šú‰»
#------------------------------------------
def initialize
@tone = Tone.new(0, 0, 0, 0)
@tone_target = Tone.new(0, 0, 0, 0)
@tone_duration = 0
@flash_color = Color.new(0, 0, 0, 0)
@flash_duration = 0
@shake_power = 0
@shake_speed = 0
@shake_duration = 0
@shake_direction = 1
@shake = 0
@pictures = [nil]
for i in 1..100
@pictures.push(Game_Picture.new(i))
end
@weather_type = 0
@weather_max = 0.0
@weather_type_target = 0
@weather_max_target = 0.0
@weather_duration = 0
end
#------------------------------------------
# œ F’²•ύX‚ÌŠJŽn
# tone : F’²
# duration : ŽžŠÔ
#------------------------------------------
def start_tone_change(tone, duration)
@tone_target = tone.clone
@tone_duration = duration
if @tone_duration == 0
@tone = @tone_target.clone
end
end
#------------------------------------------
# œ ƒtƒ‰ƒbƒVƒ…‚ÌŠJŽn
# color : F
# duration : ŽžŠÔ
#------------------------------------------
def start_flash(color, duration)
@flash_color = color.clone
@flash_duration = duration
end
#------------------------------------------
# œ ƒVƒFƒCƒN‚ÌŠJŽn
# power : ‹­‚³
# speed : ‘¬‚³
# duration : ŽžŠÔ
#------------------------------------------
def start_shake(power, speed, duration)
@shake_power = power
@shake_speed = speed
@shake_duration = duration
end
#------------------------------------------
# œ “VŒó‚̐ݒè
# type : ƒ^ƒCƒv
# power : ‹­‚³
# duration : ŽžŠÔ
#------------------------------------------
def weather(type, power, duration)
@weather_type_target = type
if @weather_type_target != 0
@weather_type = @weather_type_target
end
if @weather_type_target == 0
@weather_max_target = 0.0
else
@weather_max_target = (power + 1) * 4.0
end
@weather_duration = duration
if @weather_duration == 0
@weather_type = @weather_type_target
@weather_max = @weather_max_target
end
end
#------------------------------------------
# œ ƒtƒŒ[ƒ€XV
#------------------------------------------
def update
if @tone_duration >= 1
d = @tone_duration
@tone.red = (@tone.red * (d - 1) + @tone_target.red) / d
@tone.green = (@tone.green * (d - 1) + @tone_target.green) / d
@tone.blue = (@tone.blue * (d - 1) + @tone_target.blue) / d
@tone.gray = (@tone.gray * (d - 1) + @tone_target.gray) / d
@tone_duration -= 1
end
if @flash_duration >= 1
d = @flash_duration
@flash_color.alpha = @flash_color.alpha * (d - 1) / d
@flash_duration -= 1
end
if @shake_duration >= 1 or @shake != 0
delta = (@shake_power * @shake_speed * @shake_direction) / 10.0
if @shake_duration <= 1 and @shake * (@shake + delta) < 0
@shake = 0
else
@shake += delta
end
if @shake > @shake_power * 2
@shake_direction = -1
end
if @shake < - @shake_power * 2
@shake_direction = 1
end
if @shake_duration >= 1
@shake_duration -= 1
end
end
if @weather_duration >= 1
d = @weather_duration
@weather_max = (@weather_max * (d - 1) + @weather_max_target) / d
@weather_duration -= 1
if @weather_duration == 0
@weather_type = @weather_type_target
end
end
if $game_temp.in_battle
for i in 51..100
@pictures[i].update
end
else
for i in 1..50
@pictures[i].update
end
end
end
end
Publicité

Publié dans poubelle

Pour être informé des derniers articles, inscrivez vous :
Commenter cet article