XP 스크립트

http://www.rpg-palace.com/forums/showthread.php?p=202565
링크된 쓰레드를 보시기 바랍니다. 수퍼패미컴용으로 나온 RPG들을 생각하시면 이해가 쉬울 겁니다(정말?). 사용법은 스크립트의 주석을 참조하세요.


=begin

Mode07 on the Map!
Includes:
Mode07
Overworld Sprite Resize
Written by mewsterus

Special Thanks:
Fanha Giang (for a reverse engineered Tilemap class)

To install, replace all of Spriteset_Map with this.

To activate Mode07, add [#XX] to the map's name, replacing XX with the
percentage of Mode07 to apply. Greater numbers will result in a more slanted
world.
To activate overworld sprite resize, add [OV] to the map's name. This will make
sprites smaller on that map.

For the purposes of location script-xs, these identifiers will not appear.
--------------------------------------------------------------------------------
* Draw_Tilemap v1.72-0.6
Fanha Giang, 02/12/2006 (mm/dd/yyyy)
Edited for Mode07 by mewsterus 08/08/2006 (mm/dd/yyyy)
=end
#===============================================================================
$width = 640 # Screen width (will not change resolution,
$height = 480 # Screen height here for compatibility)
$ov_zoom = 0.3 # Overworld zoom multiplier
$data_map = load_data("Data/MapInfos.rxdata")
#===============================================================================
class RPG::MapInfo
def name
return @name.gsub(/[.*]/) {""}
end
#-----------------------------------------------------------------------------
def original_name
return @name
end
#-----------------------------------------------------------------------------
def overworld?
return @name.scan(/[OV]/).size > 0
end
#-----------------------------------------------------------------------------
def pitch
@name =~ /[#[ ]*([00-99]+)]/i
return $1.to_f
end
end
#===============================================================================
class Draw_Tilemap
attr_accessor :tileset
attr_accessor :map_data
attr_accessor :priorities
attr_accessor :autotiles
attr_accessor :bitmaps
attr_accessor :pitch
attr_accessor :ox
attr_accessor :oy
attr_accessor :plus_y
INDEX = # autotile definitions
[
26, 27, 32, 33, 4, 27, 32, 33, 26, 5, 32, 33, 4, 5, 32, 33,
26, 27, 32, 11, 4, 27, 32, 11, 26, 5, 32, 11, 4, 5, 32, 11,
26, 27, 10, 33, 4, 27, 10, 33, 26, 5, 10, 33, 4, 5, 10, 33,
26, 27, 10, 11, 4, 27, 10, 11, 26, 5, 10, 11, 4, 5, 10, 11,
24, 25, 30, 31, 24, 5, 30, 31, 24, 25, 30, 11, 24, 5, 30, 11,
14, 15, 20, 21, 14, 15, 20, 11, 14, 15, 10, 21, 14, 15, 10, 11,
28, 29, 34, 35, 28, 29, 10, 35, 4, 29, 34, 35, 4, 29, 10, 35,
38, 39, 44, 45, 4, 39, 44, 45, 38, 5, 44, 45, 4, 5, 44, 45,
24, 29, 30, 35, 14, 15, 44, 45, 12, 13, 18 ,19, 12, 13, 18, 11,
16, 17, 22, 23, 16, 17, 10, 23, 40, 41, 46, 47, 4, 41, 46, 47,
36, 37, 42, 43, 36, 5, 42, 43, 12, 17, 18, 23, 12, 13, 42, 43,
36, 41, 42, 47, 16, 17, 46, 47, 12, 17, 42, 47, 0, 1, 6, 7
]
X = [0, 1, 0, 1]
Y = [0, 0, 1, 1]
#-----------------------------------------------------------------------------
def initialize
@tileset = RPG::Cache.tileset($game_map.tileset_name)
@map_data = $game_map.data
@priorities = $game_map.priorities
@autotiles = []
@bitmaps = [Bitmap.new($game_map.width * 32, $game_map.height * 32 + 8),
Bitmap.new($game_map.width * 32, $game_map.height * 32 + 8),
Bitmap.new($game_map.width * 32, $game_map.height * 32 + 8),
Bitmap.new($game_map.width * 32, $game_map.height * 32 + 8),
Bitmap.new($game_map.width * 32, $game_map.height * 32 + 8),
Bitmap.new($game_map.width * 32, $game_map.height * 32 + 8)]
@pitch = $data_map[$game_map.map_id].pitch
@ox = 0
@oy = 0
@plus_y = $game_map.plus_y
@anim = 0
@anim_top = 0
for i in 0..6
@autotiles.push(RPG::Cache.autotile($game_map.autotile_names[i]))
@anim_top = [@autotiles[i].width / 96 - 1, @anim_top].max
end
@sprites = [[], [], []]
for i in 0..2
for j in 0..$game_map.height * 4 - 1
@sprites[i].push(Sprite.new)
@sprites[i][j].bitmap = Bitmap.new($game_map.width * 32, 16)
@sprites[i][j].x = 0
@sprites[i][j].y = -16
@sprites[i][j].z = -5 + (i * 10)
end
end
@disposed = false
draw
end
#-----------------------------------------------------------------------------
def update
@plus_y = $game_map.plus_y
for i in 0..2
for j in [0, (($height / 2) - (($height * 30) /
@pitch) + @oy) / 8].max.to_i..[@sprites[i].size - 1, (@oy +
$height) / 8].min.to_i
@sprites[i][j].x = $width / 2
@sprites[i][j].y = j * 8 - @oy
unless @pitch == 0
@sprites[i][j].zoom_x =
@sprites[i][j].zoom_y = (@sprites[i][j].y - $height / 2) *
(@pitch / ($height * 50)) + 1
@sprites[i][j].y += 8 * (1 - @sprites[i][j].zoom_y) *
((1 - @sprites[i][j].zoom_y) /
(2 * ((@pitch / 200) / ($height / 16.0))) + 0.5)
end
@sprites[i][j].y += @plus_y * 32
@sprites[i][j].ox = @ox + $width / 2
end
end
end
#-----------------------------------------------------------------------------
def dispose
for i in 0..2
for j in @sprites[i]
j.bitmap.dispose
j.dispose
end
end
for i in @bitmaps
i.dispose
end
@tileset.dispose
for i in 0..6
@autotiles[i].dispose
end
@disposed = true
end
#-----------------------------------------------------------------------------
def disposed?
return @disposed
end
#-----------------------------------------------------------------------------
def draw
for x in 0...@map_data.xsize
for y in 0...@map_data.ysize
draw_position(x, y)
end
end
for i in [5, 4, 3]
@bitmaps[i-1].blt(0, 0, @bitmaps[i],
Rect.new(0, 0, @bitmaps[i].width, @bitmaps[i].height))
end
for i in 0..2
@bitmaps[i].blt(0, $game_map.height * 32, @bitmaps[i],
Rect.new(0, 0, @bitmaps[i].width, 8))
end
k = 0
for i in 0..2
for j in 0..@sprites[i].size - 1
@sprites[i][j].bitmap.blt(0, 0, @bitmaps[i],
Rect.new(0, j * 8, $game_map.width * 32, 16))
end
end
end
#-----------------------------------------------------------------------------
def draw_position(x, y)
for layer in 0..2
pos = @map_data[x, y, layer]
if pos >= 384 #if it is a tile
src_rect = Rect.new(((pos-384)%8)*32, ((pos-384)/8)*32, 32, 32)
@bitmaps[@priorities[pos]].blt(x * 32, y * 32, @tileset, src_rect)
next layer
end
if pos >= 48 and pos < 384 #if it is an autotile
id = pos / 48 - 1
plus_x = ((@anim / 4) % (@autotiles[id].width / 96)) * 96
for corner in 0..3
h = 4 * (pos % 48) + corner
src_rect = Rect.new((INDEX[h]%6)*16+plus_x, (INDEX[h]/6)*16, 16, 16)
@bitmaps[@priorities[pos]].blt(x*32+X[corner]*16, y*32+Y[corner]*16,
@autotiles[id], src_rect)
end
end
end
end
end
#===============================================================================
class Game_Map
attr_accessor :plus_y
#-----------------------------------------------------------------------------
def name
return $data_map[@map_id].name
end
end
#===============================================================================
class Sprite_Character < RPG::Sprite
attr_accessor :character
#-----------------------------------------------------------------------------
def initialize(character = nil)
super()
@character = character
update
end
#-----------------------------------------------------------------------------
def update
super
@pitch = $data_map[$game_map.map_id].pitch.to_f
self.zoom_x =
self.zoom_y = (@character.screen_y - $height / 2) *
(@pitch / ($height * 50)) + 1
if @tile_id != @character.tile_id or
@character_name != @character.character_name or
@character_hue != @character.character_hue
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_hue = @character.character_hue
if @tile_id >= 384
self.bitmap = RPG::Cache.tile($game_map.tileset_name,
@tile_id, @character.character_hue)
self.src_rect.set(0, 0, 32, 32)
self.ox = 16
self.oy = 32
else
self.bitmap = RPG::Cache.character(@character.character_name,
@character.character_hue)
@cw = bitmap.width / 4
@ch = bitmap.height / 4
self.ox = @cw / 2
self.oy = @ch
if $data_map[$game_map.map_id].overworld? and
@character.is_a?(Game_Player)
self.zoom_x *= $ov_zoom
self.zoom_y *= $ov_zoom
end
end
end
self.visible = (not @character.transparent)
if @tile_id == 0
sx = @character.pattern * @cw
sy = (@character.direction - 2) / 2 * @ch
self.src_rect.set(sx, sy, @cw, @ch)
end
self.x = ($width / 2) + ((@character.screen_x - ($width / 2)) * self.zoom_x)
self.y = @character.screen_y
self.y += (8 * (1 - self.zoom_y) * ((1 - self.zoom_y) /
(2 * ((@pitch / 200) / ($height / 16.0))) + 0.5)) if @pitch != 0
self.y += $game_map.plus_y * 32 unless @character.is_a?(Game_Player)
self.z = @character.screen_z(@ch) - (self.zoom_y < 0.5 ? 1000 : 0)
self.opacity = @character.opacity
self.blend_type = @character.blend_type
self.bush_depth = @character.bush_depth
if @character.animation_id != 0
animation = $data_animations[@character.animation_id]
animation(animation, true)
@character.animation_id = 0
end
end
end
#===============================================================================
class Spriteset_Map
def initialize
$game_map.plus_y = 0
@viewport1 = Viewport.new(0, 0, 640, 480)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 2000
@viewport3.z = 5000
@tilemap = Draw_Tilemap.new
@panorama = Plane.new
@panorama.z = -1000
@fog = Plane.new
@fog.z = 3000
@character_sprites = []
for i in $game_map.events.keys.sort
sprite = Sprite_Character.new($game_map.events[i])
@character_sprites.push(sprite)
end
@character_sprites.push(Sprite_Character.new($game_player))
@weather = RPG::Weather.new(@viewport1)
@picture_sprites = []
for i in 1..50
@picture_sprites.push(Sprite_Picture.new(@viewport2,
$game_screen.pictures[i]))
end
@timer_sprite = Sprite_Timer.new
update
end
#-----------------------------------------------------------------------------
def dispose
@tilemap.dispose
@panorama.dispose
@fog.dispose
for sprite in @character_sprites
sprite.dispose
end
@weather.dispose
for sprite in @picture_sprites
sprite.dispose
end
@timer_sprite.dispose
@viewport1.dispose
@viewport2.dispose
@viewport3.dispose
end
#-----------------------------------------------------------------------------
def update
if @panorama_name != $game_map.panorama_name or
@panorama_hue != $game_map.panorama_hue
@panorama_name = $game_map.panorama_name
@panorama_hue = $game_map.panorama_hue
if @panorama.bitmap != nil
@panorama.bitmap.dispose
@panorama.bitmap = nil
end
if @panorama_name != ""
@panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)
end
Graphics.frame_reset
end
if @fog_name != $game_map.fog_name or @fog_hue != $game_map.fog_hue
@fog_name = $game_map.fog_name
@fog_hue = $game_map.fog_hue
if @fog.bitmap != nil
@fog.bitmap.dispose
@fog.bitmap = nil
end
if @fog_name != ""
@fog.bitmap = RPG::Cache.fog(@fog_name, @fog_hue)
end
Graphics.frame_reset
end
@tilemap.ox = $game_map.display_x / 4
@tilemap.oy = $game_map.display_y / 4
@tilemap.update
@panorama.ox = $game_map.display_x / 8
@panorama.oy = $game_map.display_y / 8
@fog.zoom_x = $game_map.fog_zoom / 100.0
@fog.zoom_y = $game_map.fog_zoom / 100.0
@fog.opacity = $game_map.fog_opacity
@fog.blend_type = $game_map.fog_blend_type
@fog.ox = $game_map.display_x / 4 + $game_map.fog_ox
@fog.oy = $game_map.display_y / 4 + $game_map.fog_oy
@fog.tone = $game_map.fog_tone
for sprite in @character_sprites
sprite.update
end
@weather.type = $game_screen.weather_type
@weather.max = $game_screen.weather_max
@weather.ox = $game_map.display_x / 4
@weather.oy = $game_map.display_y / 4
@weather.update
for sprite in @picture_sprites
sprite.update
end
@timer_sprite.update
@viewport1.tone = $game_screen.tone
@viewport1.ox = $game_screen.shake
@viewport3.color = $game_screen.flash_color
@viewport1.update
@viewport3.update
end
end

Who's 백호

?

이상혁입니다.

http://elab.kr

Comment '3'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6153
861 기타 엔딩후 캐릭터 이어서 새로운 게임시작 스크립트 1 file 백호 2009.02.21 1263
860 메뉴 개별 메뉴 호출 단축키 스크립트 5 file 백호 2009.02.21 1965
859 전투 사이드뷰 전투(보행그래픽) 15 file 백호 2009.02.21 4244
858 전투 액티브 타임 배틀(보행그래픽) file 백호 2009.02.21 2104
857 전투 마법검 스크립트 file 백호 2009.02.21 1118
856 전투 마법반사 스크립트 1 file 백호 2009.02.21 1217
855 장비 장비 착용 효과 스크립트 14 file 백호 2009.02.21 2323
854 기타 상점 변동시세 적용 스크립트 3 file 백호 2009.02.21 1163
853 이동 및 탈것 데쉬 기능 스크립트 8 file 백호 2009.02.21 1508
852 전투 배틀 스테이터스·클리어 디자인 13 file 백호 2009.02.21 2468
851 전투 레벨 상승 화면 개조 스크립트 4 file 백호 2009.02.21 1884
850 메뉴 FF7형식의 메뉴로 변경하는 스크립트 1 file 백호 2009.02.21 1463
849 전투 렙업했을때 포인트 주고 스탯 올리기 7 file 백호 2009.02.21 1684
848 상태/속성 순간 적으로 무적상태되는 스크립트 백호 2009.02.21 1161
847 기타 모험 일기 스크립트 2 file 백호 2009.02.21 1434
846 기타 요리 시스템 스크립트 12 file 백호 2009.02.21 2023
845 이동 및 탈것 기차스크립트 6 백호 2009.02.21 1757
844 메뉴 링메뉴 스크립트 file 백호 2009.02.21 1391
843 상점 상점 직접 장비 스크립트 1 file 백호 2009.02.21 1771
842 전투 전투 특수효과 ActionEX 스크립트 1 file 백호 2009.02.21 1659
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