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
» 기타 다중 파노라마 사용 by Guillaume777 file 백호 2009.02.22 886
540 능력치 올리기 스크립트 21 file 아방스 2007.11.09 3447
539 기타 능력치 무한대 스크립트 (따로 넣을필요없음) 2 백호 2009.02.21 1027
538 온라인 넷플레이1.7.0+abs5.5+한챗 49 쀍뛝쒧 2009.01.24 7286
537 메뉴 넷플레이 업그레이드됀 메뉴 스크립트 4 백호 2009.02.22 2040
536 HUD 넷플레이 HUD표시 2 file 백호 2009.02.22 3094
535 넷플2.0(펌) 3번째 4 오동훈 2008.02.25 1303
534 넷플2.0(펌) 2번째 2 오동훈 2008.02.25 1498
533 넷플2.0(펌) 1 오동훈 2008.02.25 1543
532 전투 깔끔한형식의 Asan'Tear배틀시스탬 4 file 콩밥 2010.09.29 4124
531 이동 및 탈것 기차스크립트 6 백호 2009.02.21 1757
530 스킬 기술문서(스킬 습득 아이템) 7 ok하승헌 2010.02.18 2132
529 기타 기본설정 강화ㄴ 1 백호 2009.02.21 1047
528 메뉴 기본메뉴 뜯어고친것. (스샷추가) 6 file 백호 2009.02.22 4313
527 이동 및 탈것 금금님 요청 대쉬 1 백호 2009.02.22 1382
526 이동 및 탈것 그림자 스크립트 13 file 백호 2009.02.22 3540
525 이동 및 탈것 그래픽의 크기로 좁은길은 못지나가게한다. 7 file 백호 2009.02.21 1816
524 이동 및 탈것 그래픽 변경 데쉬 3 file 백호 2009.02.22 2499
523 기타 광물캐기 시스템 v2 3 백호 2009.02.22 1775
522 기타 광물캐기 스크립트 1 file 백호 2009.02.22 1850
Board Pagination Prev 1 ... 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 ... 52 Next
/ 52