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
601 파티 메뉴커맨드로 파티 멤버들 순서 바꾸기 by Yargovish 1 백호 2009.02.22 1620
600 오디오 WinAMP 플러그인을 이용하여 RMXP에서 다른 형식의 음악파일 재생하기 file 백호 2009.02.22 1259
599 기타 아래 스크립트에 대한 Guillaume777님의 개량판입니다. 백호 2009.02.22 880
598 아이템 아이템을 얻으면 자동으로 아이템 입수 메세지윈도우 띄우기 4 백호 2009.02.22 2279
597 메뉴 자작 커스텀 메뉴(데모 첨부) 3 백호 2009.02.22 2348
596 메뉴 KGC 메뉴화면 개조 스크립트 번역 3 file 백호 2009.02.22 1941
595 기타 KGC 디버거 (최신 올라온 것에 비해 성능은 딸리지만) file 백호 2009.02.22 929
594 장비 Multi-equip script ver.6 by Guillaume777 4 file 백호 2009.02.22 1210
593 기타 일시정지 스크립트 2 file 백호 2009.02.22 1796
592 아이템 아이템 인벤토리 2 file 백호 2009.02.22 3356
591 기타 Weather Script 1.02 by ccoa 1 file 백호 2009.02.22 809
590 메시지 Animated Window Skin by Tana 1 백호 2009.02.22 1338
589 스킬 Skill Shop by SephirothSpawn file 백호 2009.02.22 813
» 기타 다중 파노라마 사용 by Guillaume777 file 백호 2009.02.22 886
587 그래픽 Bitmap update 2.0 by Linkin_T 1 백호 2009.02.22 985
586 기타 ABS 몬스터 HP 게이지 바 11 백호 2009.02.22 2485
585 맵/타일 Map Event Large Make 2 백호 2009.02.22 1132
584 기타 파노라마 스크롤 스크립트 개량판 by Guillaume777 1 백호 2009.02.22 896
583 HUD 맵 이름 표시 by Slipknot@rmxp.net (SDK호환) 2 백호 2009.02.22 1463
582 기타 제작한 게임의 파일을 모두 exe파일 하나에 쓸어담기 by sheefo@Creation Asylum 1 file 백호 2009.02.22 1239
Board Pagination Prev 1 ... 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ... 52 Next
/ 52