XP 스크립트

한 맵에서 여러 개의 파노라마를 사용하게 하는 스크립트입니다.  각각의 파노라마가 다른 속도로 스크롤되게 할 수도 있습니다(파노라마 자동 스크롤 코드는 RPG Advocate님의 코드에 기반).  사용법은 스크립트의 주석에 있습니다.

#==============================================================================
# Multi-panorama script
#------------------------------------------------------------------------------
# Guillaume777
# 1
# 2005/12/28
#==============================================================================
#
#
# To use it, make a script event with something like
# $game_map.panoramas[0] = Panorama.new('city_pano.png', 0, -500, 2, -3, 1.0/12.0, 1.0/8.0)
#
# [0] is specific place inside the panoramas array where panorama info saved
# city_pano.png is the name of the panorama picture file in GraphicsPanoramas
# 0 is the hue
# -500 is the z ( higher z : draw on top of lower z )
# 2 is autoscroll x speed
# -3 is the autoscroll y speed
# 1.0/12.0 is ratio of panorama moved / camera moved. Higher ration means faster
# panorama scrolling as you move around horizontaly
# 1.0/8.0 is ratio of panorama moved / camera moved vertically
#
# You can also use $game_map.panoramas[0].z, $game_map.panoramas[0].name etc to
# change the panorama
#
# Extra panoramas are going to stay in all maps unless you remove them
# If you want to remove all extra panorama ( for exemple changing the map ) use
# $game_map.panoramas = nil
#
class Game_Map
#--------------------------------------------------------------------------
# Make array to store panoramas in $game_map.panoramas
#--------------------------------------------------------------------------
def panoramas
if @panoramas == nil then @panoramas = Array.new end
return @panoramas
end

def panoramas=(array)
for i in 0...self.panoramas.size
if self.panoramas[i] != nil then
self.panoramas[i].dispose
self.panoramas[i] = nil
end
end
@panoramas = array
end
end

class Spriteset_Map
#--------------------------------------------------------------------------
# * Update new panoramas and or create the plane with viewport1
#--------------------------------------------------------------------------
alias g7_mp_spriteset_map_update update
def update
g7_mp_spriteset_map_update

for i in 0...$game_map.panoramas.size
if $game_map.panoramas[i] != nil then
if $game_map.panoramas[i].plane == nil then
$game_map.panoramas[i].plane = Plane.new(@viewport1)
end
$game_map.panoramas[i].update
end
end
end

#--------------------------------------------------------------------------
# Dispose extra panoramas
#--------------------------------------------------------------------------
alias g7_mp_spriteset_map_dispose dispose
def dispose
g7_mp_spriteset_map_dispose
for i in 0...$game_map.panoramas.size
if $game_map.panoramas[i] != nil then $game_map.panoramas[i].dispose end
end
end
end


#--------------------------------------------------------------------------
# This class holds all data relevant to the panorama
#--------------------------------------------------------------------------
class Panorama
attr_accessor :name #name of file to use as panorama
attr_accessor :hue #color hue, 0 default
attr_accessor :z # z value of panorama, used to determine what draws on top
attr_accessor :plane #plane used to draw the panorama

attr_accessor :autoscroll_x_speed #autoscroll horizontality value
attr_accessor :autoscroll_y_speed
attr_accessor :move_speed_x #ratio panorama moved / camera moved, 1.0/8.0 default
attr_accessor :move_speed_y


#--------------------------------------------------------------------------
# This init the panorama, but doesnt create the plane
#--------------------------------------------------------------------------
def initialize(name='', hue=0, z = -1200,
autoscroll_x_speed = 0, autoscroll_y_speed = 0,
move_speed_x = 1.0/8.0, move_speed_y = 1.0/8.0)
@z = z
@name = name
@hue = hue
@autoscroll_x_speed = autoscroll_x_speed
@autoscroll_y_speed = autoscroll_y_speed
@move_speed_x = move_speed_x
@move_speed_y = move_speed_y

@current_name = ''
@current_hue = 0
@scroll_frames_x = 0
@scroll_frames_y = 0
@scroll_point_x = 0
@scroll_point_y = 0

end

def dispose
@current_name = ''
@plane.dispose
@plane = nil
end


#--------------------------------------------------------------------------
# Update ox and oy of panorama
#--------------------------------------------------------------------------
def update
if @current_name != @name or
@current_hue != @hue
@current_name = @name
@current_hue = @hue
if @plane.bitmap != nil #if not old panorama then remove old panorama
@plane.bitmap.dispose
@plane.bitmap = nil
end
if @current_name != "" #if new panorama then add the new panorama
@plane.bitmap = RPG::Cache.panorama(@name, @hue)
end
end

# Update panorama plane
@plane.z = @z
if @autoscroll_x_speed != 0 or @autoscroll_y_speed != 0
self.scroll #get new scroll_point values
#change the paronama ox and oy for new values
@plane.ox = @scroll_point_x + $game_map.display_x * @move_speed_x
@plane.oy = @scroll_point_y + $game_map.display_y * @move_speed_y
else
@plane.ox = $game_map.display_x * @move_speed_x
@plane.oy = $game_map.display_y * @move_speed_y
end
end


#--------------------------------------------------------------------------
# Get new @scroll_point values
#--------------------------------------------------------------------------
def scroll
w = @plane.bitmap.width
h = @plane.bitmap.height

@scroll_frames_x += @autoscroll_x_speed
@scroll_frames_y += @autoscroll_y_speed
while @scroll_frames_x >= 8
@scroll_frames_x -= 8
@scroll_point_x += 1
end
while @scroll_frames_x <= -8
@scroll_frames_x += 8
@scroll_point_x -= 1
end
while @scroll_frames_y >= 8
@scroll_frames_y -= 8
@scroll_point_y += 1
end
while @scroll_frames_y <= -8
@scroll_frames_y += 8
@scroll_point_y -= 1
end
if @scroll_point_x > w
@scroll_point_x -= w
end
if @scroll_point_x < -w
@scroll_point_x += w
end
if @scroll_point_y > h
@scroll_point_y -= h
end
if @scroll_point_y < -h
@scroll_point_y += h
end
end

end

Who's 백호

?

이상혁입니다.

http://elab.kr

Atachment
첨부 '1'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6153
961 기타 Near Fantastica's SDK Test Bed 3 file 백호 2009.02.22 885
960 전투 Stealing/Mugging/Scanning 6.0 Final by Trickster (SDK호환) file 백호 2009.02.22 885
» 기타 다중 파노라마 사용 by Guillaume777 file 백호 2009.02.22 886
958 아이템 아이템 소지수 무제한 1 백호 2009.02.21 887
957 기타 AMS___Advanced_Message_Script 1 file 백호 2009.02.22 889
956 아이템 Additional Item Drop by SephirothSpawn (SDK호환) 1 백호 2009.02.22 891
955 스킬 SG_Skill Invoking Battle Items by sandgolem (SDK호환) 백호 2009.02.22 894
954 기타 파노라마 스크롤 스크립트 개량판 by Guillaume777 1 백호 2009.02.22 896
953 아이템 SG_Item Break by sandgolem (SDK호환) 백호 2009.02.22 897
952 변수/스위치 SG_Gold Window Variables v2 by sandgolem (SDK호환) 백호 2009.02.22 899
951 전투 전투의 커맨드에 따라 능력치를 상승 백호 2009.02.22 904
950 기타 스크립트 자료 3 file 백호 2009.02.22 905
949 기타 좌표 스크립트 2 백호 2009.02.21 908
948 전투 배틀 포인트 1 백호 2009.02.22 918
947 기타 지정범위안에 들어오면 특정한 움직임을 취한다!! 1 백호 2009.02.21 919
946 파티 Reserve Party Tools by RPG Advocate 백호 2009.02.22 920
945 이동 및 탈것 Mouse_move file 백호 2009.02.21 922
944 전투 위치보정스크립트 한글화 1 백호 2009.02.22 922
943 기타 KGC 디버거 (최신 올라온 것에 비해 성능은 딸리지만) file 백호 2009.02.22 929
942 기타 Economy System by Nick@Creation Asylum 1 file 백호 2009.02.22 934
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 52 Next
/ 52