RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Pseudo 3D Battlebacks

0 Members and 1 Guest are viewing this topic.

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
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



Regular Map (in Map Editor)



Mode7 Version



Pseudo 3D Version

Instructions

See script. Pretty much plug and play.

Script


Code: [Select]
#===============================================================================
# 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


  • cozziekuns

Support


Post down below.

Known Compatibility Issues

Will not work with Parallax Maps.
« Last Edit: July 31, 2011, 11:37:19 PM by cozziekuns »

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Most Missed Member2014 Zero to Hero2014 Best IRC Quote2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
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.
it's like a metaphor or something i don't know

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Good idea cozzie :)

**
Rep:
Level 71
Honing the Craft
Very good! Im sticking with it!

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
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.

***
Rep:
Level 57
Everything about Rendered Fate
I apologize for necroposting, but I found a minor graphics bug.



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.
Link to my game is here.
http://rmrk.net/index.php/topic,45507.0.html
Feedback will be nice to get, constructive or otherwise.