class Game_Temp
attr_accessor :fog_name
attr_accessor :fog_opacity
attr_accessor :fog_target_opacity
attr_accessor :fog_blend_type
attr_accessor :fog_zoom
attr_accessor :fog_sx
attr_accessor :fog_sy
attr_accessor :fog_tone
alias original_initialize initialize
def initialize
original_initialize
@fog_name = ""
@fog_tone = Tone.new ( 0, 0, 0, 0 )
@fog_opacity = 0
@fog_target_opacity = 80
@fog_blend_type = 0
@fog_zoom = 100
@fog_sx = 1
@fog_sy = 1
end
end
class Game_Map
attr_accessor :fog_name
attr_accessor :fog_opacity
attr_accessor :fog_target_opacity
attr_accessor :fog_blend_type
attr_accessor :fog_zoom
attr_accessor :fog_sx
attr_accessor :fog_sy
attr_accessor :fog_ox
attr_accessor :fog_oy
attr_accessor :fog_tone
attr_accessor :fog_start_loop
attr_accessor :fog_eventid
attr_accessor :fog_visible
attr_accessor :fog
alias original_initialize initialize
def initialize
original_initialize
@fog = Plane.new ( @viewport1 )
@fog_ox = 0
@fog_oy = 0
end
alias original_setup setup
def setup ( map_id )
original_setup ( map_id )
#fog_event
end
alias original_update update
def update
original_update
if ( @fog_visible and @fog )
fog_update
end
end
def fog_init
@fog_name = $game_temp.fog_name
@fog_tone = $game_temp.fog_tone
@fog_opacity = $game_temp.fog_opacity
@fog_target_opacity = $game_temp.fog_target_opacity
@fog_blend_type = $game_temp.fog_blend_type
@fog_zoom = $game_temp.fog_zoom
@fog_sx = $game_temp.fog_sx
@fog_sy = $game_temp.fog_sy
@fog_tone_target = Tone.new ( 0, 0, 0, 0 )
@fog_tone_duration = 0
@fog_opacity_duration = 0
@fog_opacity_target = 0
@fog_previous_name = ""
fog_setup
end
def fog_setup
fog_hide
if ( ( @fog_previous_name != @fog_name ) and ( @fog_name != "" ) )
@fog.bitmap = Cache.picture ( @fog_name )
@fog_name_previous = @fog_name
@fog_opacity = @fog_target_opacity
@fog.opacity = @fog_opacity
@fog.blend_type = @fog_blend_type
@fog.zoom_x = @fog_zoom / 100
@fog.zoom_y = @fog_zoom / 100
@fog.ox = @fog_ox
@fog.oy = @fog_oy
@fog.tone = @fog_tone
@fog.z = 99
@fog_visible = true
else
fog_hide
end
end
def fog_update
@fog_ox -= @fog_sx / 8.0
@fog_oy -= @fog_sy / 8.0
if ( @fog_tone_duration >= 1 )
d = @fog_tone_duration
target = @fog_tone_target
@fog_tone.red = (@fog_tone.red * (d - 1) + target.red) / d
@fog_tone.green = (@fog_tone.green * (d - 1) + target.green) / d
@fog_tone.blue = (@fog_tone.blue * (d - 1) + target.blue) / d
@fog_tone.gray = (@fog_tone.gray * (d - 1) + target.gray) / d
@fog_tone_duration -= 1
end
if ( @fog_opacity_duration >= 1 )
d = @fog_opacity_duration
@fog_opacity = (@fog_opacity * (d - 1) + @fog_opacity_target) / d
@fog_opacity_duration -= 1
end
@fog.opacity = @fog_opacity
@fog.blend_type = @fog_blend_type
@fog.zoom_x = @fog_zoom / 100
@fog.zoom_y = @fog_zoom / 100
@fog.ox = @fog_ox
@fog.oy = @fog_oy
@fog.tone = @fog_tone
end
def fog_show
fog_init
end
def fog_hide
@fog_visible = false
@fog_opacity = 0
$game_temp.fog_opacity = 0
end
def fog_clear
@fog_visible = false
@fog_opacity = 0
$game_temp.fog_opacity = 0
@fog_target_opacity = 0
$game_temp.fog_target_opacity = 0
fog_show
end
def scroll_up ( distance )
if ( loop_vertical? )
@display_y += @map.height * 256 - distance
@display_y %= @map.height * 256
@parallax_y -= distance
@fog_oy -= distance / 8.0
else
last_y = @display_y
@display_y = [@display_y - distance, 0].max
@parallax_y += @display_y - last_y
@fog_oy += ( @display_y - last_y ) / 8.0
end
end
def scroll_down ( distance )
if ( loop_vertical? )
@display_y += distance
@display_y %= @map.height * 256
@parallax_y += distance
@fog_oy += distance / 8.0
else
last_y = @display_y
@display_y = [@display_y + distance, (height - 13) * 256].min
@parallax_y += @display_y - last_y
@fog_oy += ( @display_y - last_y ) / 8.0
end
end
def scroll_left ( distance )
if ( loop_horizontal? )
@display_x += @map.width * 256 - distance
@display_x %= @map.width * 256
@parallax_x -= distance
@fog_ox -= distance / 8.0
else
last_x = @display_x
@display_x = [@display_x - distance, 0].max
@parallax_x += @display_x - last_x
@fog_ox += ( @display_x - last_x ) / 8.0
end
end
def scroll_right ( distance )
if ( loop_horizontal? )
@display_x += distance
@display_x %= @map.width * 256
@parallax_x += distance
@fog_ox += distance / 8.0
else
last_x = @display_x
@display_x = [@display_x + distance, (width - 17) * 256].min
@parallax_x += @display_x - last_x
@fog_ox += ( @display_x - last_x ) / 8.0
end
end
end
class Scene_Map < Scene_Base
alias original_start start
def start
original_start
$game_map.fog_show
end
alias original_terminate terminate
def terminate
original_terminate
$game_map.fog_hide
end
end
class Game_Player < Game_Character
alias original_perform_transfer perform_transfer
def perform_transfer
original_perform_transfer
$game_map.fog_show
end
end
그리고나서 포그를 표시하고픈 맵이 벤트 커맨드로 아래 스크립트 명령어를 추가한다.
$game_temp.fog_name = "포그그래픽 파일명"
$game_temp.fog_zoom = 300
$game_temp.fog_sx = 1
$game_temp.fog_sy = 1
$game_temp.fog_target_opacity = 80
$game_map.fog_show
위의 스크립트가 화면에 포그 그래픽을 표시하는 명령인데.
보시면 대략 어떤 의미지는 알거라고 생각된다.
그리고 이벤트로 포그그래픽을 표시하다보니.
자동 또는 병렬처리로 이벤트를 시작하게 하고 셀프스위치로 꺼줘야겠죠?
굳이 말하지 않아도 다 아시겟지만 ^^
포그 그래픽은 Graphics/Pictures 폴더에 넣어준다.
'게임이야기. > RPG 만들기 VX' 카테고리의 다른 글
RPG 만들기 VX (설치버전 10) (2) | 2008.01.31 |
---|---|
점프를 제한 하는 스크립트 (0) | 2008.01.31 |
vx 걸을때 소리가 나도도록 하는 스크립트 (1) | 2008.01.31 |
최고레벨 제한하기 (0) | 2008.01.30 |
윈도우 크기 조절 스크립트 0.3 (0) | 2008.01.30 |
게임 시스템의 제작 (3) | 2008.01.30 |
스토리 구상하기 (4) | 2008.01.30 |