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
154 기타 레벨업스크립트(xp) 2 게임을만들자! 2014.08.05 1687
153 기타 레벨9999스크립트 4 백호 2009.02.21 1151
152 기타 레벨9999만들기스크립 23 해파리 2009.04.10 3344
151 기타 레벨,능력치 9999 3 백호 2009.02.22 1596
150 기타 레벨, 능력치 무한 스크립트 3 백호 2009.02.22 1712
149 기타 랜덤 지하 감옥 작성 스크립트 1 file 백호 2009.02.21 1338
148 기타 디버그 윈도우 강화! 3 file 백호 2009.02.21 1550
147 기타 동료들이 기차처럼 줄줄 따라온다!? 7 file 백호 2009.02.21 1990
146 기타 데이터베이스 자체 제한 해체 XP Ver. 13 THE풀잎 2010.07.04 2171
145 기타 데미지 출력 스크립트 예제 9 file 백호 2009.02.22 1559
144 기타 더블애니메이션 스크립트 1 백호 2009.02.22 1593
143 기타 대화창에 얼굴그래픽 스크립트 25 file 백호 2009.02.21 4137
142 기타 대화창 글자 한글자씩뜨는 스크립트 7 백호 2009.02.22 2185
141 기타 대화 글씨가 한글자씩 나오는 스크립트 2 백호 2009.02.22 2464
» 기타 다중 파노라마 사용 by Guillaume777 file 백호 2009.02.22 886
139 기타 능력치 무한대 스크립트 (따로 넣을필요없음) 2 백호 2009.02.21 1027
138 기타 기본설정 강화ㄴ 1 백호 2009.02.21 1047
137 기타 광물캐기 시스템 v2 3 백호 2009.02.22 1775
136 기타 광물캐기 스크립트 1 file 백호 2009.02.22 1850
135 기타 경험치 퍼센트 수정 백호 2009.02.22 1208
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 Next
/ 13