Псевдо 3д батлбек
Описание:
Скрипт делает снимок снимок экрана и использует его в качестве батл бека эффектом псевдо 3д.
Использование:
Скрипт нужно вставить перед Main.
Особенности:
Два режима работы: пресловутый Mode7 и псевдо-3D
Практически подключить и играть
Дает пользователю возможность переключать карты размытию
Предоставляет пользователю возможность изменять местоположение battlefloor изображения и прозрачность
Скрипт:
Код:
#===============================================================================
# Pseudo 3D Battlebacks
#-------------------------------------------------------------------------------
# Version: 1.1
# Author: cozziekuns (rmrk)
# Last Date Updated: 7/25/2011
#===============================================================================
# Description:
#-------------------------------------------------------------------------------
# This script is a completely plug and play solution to the aesthetically dull
# default, wavy looking battle background. It instead takes a snapshot of the
# screen and then renders a Pseudo 3D image that varies depending on your settings.
#===============================================================================
# Updates
#-------------------------------------------------------------------------------
# o 7/31/2011 - Updated with some fixes.
# o 7/25/2011 - Started Script
#===============================================================================
# To-do List
#-------------------------------------------------------------------------------
# o More Modes.
#===============================================================================
# Instructions
#-------------------------------------------------------------------------------
# Copy and paste this script above ? Main Process but below ? Materials, and
# edit the modules to your liking. Some difficult modules have links to the
# instructions.
#===============================================================================
# Mode
#-------------------------------------------------------------------------------
# MODE:
# 0 => A Mode7 like feature that changes the zoom values of Tiles B through E
# as well as A.
# 1 => A more realistic 3D like feature that only changes the zoom values of
# TileA.
#===============================================================================
module COZZIEKUNS
module P3D_BATTLE_BACKGROUNDS
MODE = 1
BLUR = false # Do you want to blur the background?
FLOOR_X = 0 # X value of Battlefloor
FLOOR_Y = 192 # Y value of BattleFloor
FLOOR_OPACITY = 0 # Opacity of BattleFloor
ZOOM = 2 # Zoom value
end
end
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
# This class handles temporary data that is not included with save data.
# The instance of this class is referenced by $game_temp.
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :layer1_vis
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias coz_gt_3d_battleback_initialize initialize
def initialize
coz_gt_3d_battleback_initialize
@layer1_vis = false
end
end
#==============================================================================
# ** Scene_Map
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# * Create Snapshot for Using as Background of Another Screen
#--------------------------------------------------------------------------
alias coz_fixed3d_snapshot_for_background snapshot_for_background
def snapshot_for_background
if $scene.is_a?(Scene_Battle)
case COZZIEKUNS::P3D_BATTLE_BACKGROUNDS::MODE
when 0
$game_temp.background_bitmap.dispose
$game_temp.background_bitmap = Graphics.snap_to_bitmap
@spriteset.dispose_layer_all
$game_temp.background_bitmap = Graphics.snap_to_bitmap
when 1
@spriteset.dispose_layer2
$game_temp.background_bitmap.dispose
$game_temp.background_bitmap = Graphics.snap_to_bitmap
@spriteset.dispose_layer1
$game_temp.background_bitmap = Graphics.snap_to_bitmap
end
end
else
coz_fixed3d_snapshot_for_background
end
end
#==============================================================================
# ** Spriteset_Map
#==============================================================================
class Spriteset_Map
#--------------------------------------------------------------------------
# * Create Dummy Sprite
#--------------------------------------------------------------------------
def create_dummy_sprite
zoom = COZZIEKUNS::P3D_BATTLE_BACKGROUNDS::ZOOM - 1
source = $game_temp.background_bitmap
bitmap = source
@battleback_sprites = []
for i in 0...416
battleback_sprite = Sprite.new(@viewport1)
battleback_sprite.bitmap = bitmap
battleback_sprite.src_rect.set(0, i, 544, 1)
battleback_sprite.x = -(i / (2).to_f) * zoom
battleback_sprite.y = i
battleback_sprite.z = -1
battleback_sprite.zoom_x = (i * (zoom / (416).to_f)) + 1
@battleback_sprites.push(battleback_sprite)
end
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
alias coz_spm_3d_battleback_dispose dispose
def dispose
dispose_dummy_sprite if @battleback_sprites != nil
coz_spm_3d_battleback_dispose
end
#--------------------------------------------------------------------------
# * Dispose Layer1 Tilemap
#--------------------------------------------------------------------------
def dispose_layer1
@tilemap.bitmaps[0] = nil
@tilemap.bitmaps[1] = nil
@tilemap.bitmaps[2] = Cache.system("TileA3")
@tilemap.bitmaps[3] = Cache.system("TileA4")
@tilemap.bitmaps[4] = nil
@tilemap.bitmaps[5] = Cache.system("TileB")
@tilemap.bitmaps[6] = Cache.system("TileC")
@tilemap.bitmaps[7] = Cache.system("TileD")
@tilemap.bitmaps[8] = Cache.system("TileE")
create_dummy_sprite
@tilemap.update
end
#--------------------------------------------------------------------------
# * Dispose Layer 2
#--------------------------------------------------------------------------
def dispose_layer2
@tilemap.bitmaps[0] = Cache.system("TileA1")
@tilemap.bitmaps[1] = Cache.system("TileA2")
@tilemap.bitmaps[2] = nil
@tilemap.bitmaps[3] = nil
@tilemap.bitmaps[4] = Cache.system("TileA5")
@tilemap.bitmaps[5] = nil
@tilemap.bitmaps[6] = nil
@tilemap.bitmaps[7] = nil
@tilemap.bitmaps[8] = nil
@tilemap.update
end
#--------------------------------------------------------------------------
# * Dispose Layer All
#--------------------------------------------------------------------------
def dispose_layer_all
create_dummy_sprite
@tilemap.bitmaps[0] = nil
@tilemap.bitmaps[1] = nil
@tilemap.bitmaps[2] = nil
@tilemap.bitmaps[3] = nil
@tilemap.bitmaps[4] = nil
@tilemap.bitmaps[5] = nil
@tilemap.bitmaps[6] = nil
@tilemap.bitmaps[7] = nil
@tilemap.bitmaps[8] = nil
@tilemap.update
end
#--------------------------------------------------------------------------
# * Dispose Dummy Sprite
#--------------------------------------------------------------------------
def dispose_dummy_sprite
for sprite in @battleback_sprites
sprite.dispose
end
end
end
#==============================================================================
# ** Spriteset_Battle
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# * Create Battleback Sprite
#--------------------------------------------------------------------------
def create_battleback
@battleback_sprite = Sprite.new(@viewport1)
@battleback_sprite.bitmap = $game_temp.background_bitmap.clone
@battleback_sprite.bitmap.blur if COZZIEKUNS::P3D_BATTLE_BACKGROUNDS::BLUR
end
#--------------------------------------------------------------------------
# * Create Battlefloor Sprite
#--------------------------------------------------------------------------
def create_battlefloor
@battlefloor_sprite = Sprite.new(@viewport1)
@battlefloor_sprite.bitmap = Cache.system("BattleFloor")
@battlefloor_sprite.x = COZZIEKUNS::P3D_BATTLE_BACKGROUNDS::FLOOR_X
@battlefloor_sprite.y = COZZIEKUNS::P3D_BATTLE_BACKGROUNDS::FLOOR_Y
@battlefloor_sprite.z = 1
@battlefloor_sprite.opacity = COZZIEKUNS::P3D_BATTLE_BACKGROUNDS::FLOOR_OPACITY
end
end
Социальные закладки