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
480 이동 및 탈것 대쉬 밑에 꺼 MP가 깍기는거 1 백호 2009.02.22 1467
479 전투 대전게임 Fighter 1 file 백호 2009.02.21 1436
478 기타 대화 글씨가 한글자씩 나오는 스크립트 2 백호 2009.02.22 2464
477 기타 대화창 글자 한글자씩뜨는 스크립트 7 백호 2009.02.22 2185
476 메시지 대화창에 얼굴 그래픽 띠우기 73 아방스 2007.11.09 7119
475 이름입력 대화창에 얼굴, 이름 띄우기 37 킬라롯 2008.11.09 7496
474 기타 대화창에 얼굴그래픽 스크립트 25 file 백호 2009.02.21 4137
473 기타 더블애니메이션 스크립트 1 백호 2009.02.22 1593
472 미니맵 던전용 미니맵 스크립트[사용법 추가] 16 file 배포 2008.03.02 3443
471 전투 데미지 출력 스크립트 6 백호 2009.02.22 1810
470 기타 데미지 출력 스크립트 예제 9 file 백호 2009.02.22 1559
469 전투 데미지 폰트변경 7 카르닉스 2010.02.26 2600
468 전투 데미지 표시 개조 8 file 백호 2009.02.21 2532
467 전투 데미지마루 백호 2009.02.21 1163
466 이동 및 탈것 데쉬 기능 스크립트 8 file 백호 2009.02.21 1508
465 기타 데이터베이스 자체 제한 해체 XP Ver. 13 THE풀잎 2010.07.04 2171
464 이동 및 탈것 도트이동 5 file 허걱 2009.08.19 2889
463 이동 및 탈것 동료들끼리 따라오는 스크립트 41 file ◐아이흥행 2010.01.23 3714
462 기타 동료들이 기차처럼 줄줄 따라온다!? 7 file 백호 2009.02.21 1990
Board Pagination Prev 1 ... 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 ... 52 Next
/ 52