Pseudo 3D Battlebacks
Version: 1.1
Author: cozziekuns
Date: July 25, 2011
Version History
- <Version 1.1> 2011.07.31 - Updated with a width fix and customisable zoom.
- <Version 1.0> 2011.07.25 - Original Release
Planned Future Versions
- <Version 1.2> More modes.
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.
Features
- Two modes: the infamous Mode7 and Pseudo-3D
- Virtually plug and play
- Gives the user the ability to toggle map bluring
- Gives the user the ability to change the battlefloor image's location and opacity
Screenshots
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi52.tinypic.com%2F2ry3vyw.png&hash=6f466603e5346b3139dedf0b1a37f768623c62cc)
Regular Map (in Map Editor)
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi53.tinypic.com%2Fmwqng5.png&hash=8a2c4b772e7e04aea56f27bbd6aae4947104b427)
Mode7 Version
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi56.tinypic.com%2F2cwndwp.png&hash=38644d39dd6de5a87cbfc047aa8417841798cf16)
Pseudo 3D Version
Instructions
See script. Pretty much plug and play.
Script
#===============================================================================
# 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 = 0
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
Credit
Support
Post down below.
Known Compatibility Issues
Will not work with Parallax Maps.
Something to add to your Future Versions: making it work with parallax maps. It should be pretty easy, really. Except the Mode 7 bit D:
Otherwise, snappy work. Good stuff.
Good idea cozzie :)
Very good! Im sticking with it!
Thanks for the support guys. I updated it with a little bugfix and a feature that allows you to change the final zoom value of the background. Nothing big.
I apologize for necroposting, but I found a minor graphics bug.
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi1153.photobucket.com%2Falbums%2Fp516%2FTatton_Ray%2FGlitch.png&hash=d9e27a23216f9f562a961fa9856c31f56724a291)
If you notice the shadows are copying themselves and creating a very wierd pattern. One blends normally with the map, which is good, but the other isn't adhering, and that is what is creating the glitch. If it can be fixed, I appreciate it.