I've only just begun my attempt at converting this to MV format with no javascript knowledge what-so-ever so I'm looking for as much advice as I can get.
My basic goal/hope is I've done SOMETHING right in this thing so far...it's a plus if I've done alot right so far but I'm not holding my breath!
//Battle transition Plugin
//Converted from it's VX Ace Version to MV by Deathsia
/*
This is my first ever attempt at a javascript plugin. So please provide advice if you can offer it.
==========================================================================================================
Basic Information
==========================================================================================================
This plugin changes the way rpg maker mv handles battle transitions.
As it stands, this plugin only allows for a swirl effect similar to final fantasy 7's battle transition.
==========================================================================================================
*/
function FrameBuffer
var self.start(frames = 1, viewport_z = 10000)
dispose unless disposed?
this_frame = Graphics.snap_to_bitmap
@buffer = []
@viewport = Viewport.new
@viewport.z = viewport_z
var frames.times do
sprite = Sprite.new(@viewport)
sprite.bitmap = this_frame.clone
sprite.x = Graphics.width / 2
sprite.y = Graphics.height / 2
sprite.ox = Graphics.width / 2
sprite.oy = Graphics.height / 2
@buffer.push(sprite)
end
this_frame.dispose
end
var self.dispose
return if disposed?
@buffer.each {|sprite| sprite.dispose}
@viewport.dispose if @viewport
@buffer = nil
end
var self.disposed?
!@buffer
end
//Deletes the oldest frame bitmaps and shuffles all the bitmaps down
//replacing the first frame with a fresh snap shot
var self.cycle
return if disposed?
@buffer[-1].bitmap.dispose
@buffer.each_index do |i|
next if i == 0
@buffer.bitmap = @buffer[i - 1].bitmap
end
@buffer[0].bitmap = Graphics.snap_to_bitmap
end
//Set's all the frame buffer sprites to use a fresh snapshot
var self.refresh
this_frame = Graphics.snap_to_bitmap
@buffer.each do |sprite|
sprite.bitmap.dispose
sprite.bitmap = this_frame.clone
end
this_frame.dispose
end
var self.[](num)
return nil if disposed?
return @buffer[num]
end
end
function Scene_Map < Scene_Base
//--------------------------------------------------------------------------
// Preprocessing for Battle Screen Transition
//--------------------------------------------------------------------------
Scene_Battle.prototype.create = function() {
Graphics.update
Graphics.freeze
FrameBuffer.start(3)
FrameBuffer[0].z = 0
FrameBuffer[0].zoom_x = 1
FrameBuffer[0].zoom_y = 1
FrameBuffer[0].opacity = 235
FrameBuffer[0].angle = 0
FrameBuffer[0].blend_type = 0
FrameBuffer[1].z = 1
FrameBuffer[1].zoom_x = 1.01
FrameBuffer[1].zoom_y = 1.01
FrameBuffer[1].opacity = 128
FrameBuffer[1].angle = 359
FrameBuffer[1].blend_type = 0
FrameBuffer[2].z = 2
FrameBuffer[2].zoom_x = 0.8
FrameBuffer[2].zoom_y = 0.9
FrameBuffer[2].opacity = 12
FrameBuffer[2].angle = 12
FrameBuffer[2].blend_type = 1
@spriteset.dispose_characters
BattleManager.save_bgm_and_bgs
BattleManager.play_battle_bgm
Sound.play_battle_start
end
//--------------------------------------------------------------------------
// Execute Pre-Battle Transition
//--------------------------------------------------------------------------
Scene_Battle.prototype.start = function() {
Graphics.transition(1)
(0..60).each do |i|
Graphics.brightness = 255
FrameBuffer.refresh
Graphics.frame_reset
Graphics.brightness = 255 - (255 * ((i - 40) / 20.0)) if i > 40
Graphics.update
end
FrameBuffer.dispose
Graphics.freeze
end
end
//Converted from it's VX Ace Version to MV by Deathsia
/*
This is my first ever attempt at a javascript plugin. So please provide advice if you can offer it.
==========================================================================================================
Basic Information
==========================================================================================================
This plugin changes the way rpg maker mv handles battle transitions.
As it stands, this plugin only allows for a swirl effect similar to final fantasy 7's battle transition.
==========================================================================================================
*/
function FrameBuffer
var self.start(frames = 1, viewport_z = 10000)
dispose unless disposed?
this_frame = Graphics.snap_to_bitmap
@buffer = []
@viewport = Viewport.new
@viewport.z = viewport_z
var frames.times do
sprite = Sprite.new(@viewport)
sprite.bitmap = this_frame.clone
sprite.x = Graphics.width / 2
sprite.y = Graphics.height / 2
sprite.ox = Graphics.width / 2
sprite.oy = Graphics.height / 2
@buffer.push(sprite)
end
this_frame.dispose
end
var self.dispose
return if disposed?
@buffer.each {|sprite| sprite.dispose}
@viewport.dispose if @viewport
@buffer = nil
end
var self.disposed?
!@buffer
end
//Deletes the oldest frame bitmaps and shuffles all the bitmaps down
//replacing the first frame with a fresh snap shot
var self.cycle
return if disposed?
@buffer[-1].bitmap.dispose
@buffer.each_index do |i|
next if i == 0
@buffer.bitmap = @buffer[i - 1].bitmap
end
@buffer[0].bitmap = Graphics.snap_to_bitmap
end
//Set's all the frame buffer sprites to use a fresh snapshot
var self.refresh
this_frame = Graphics.snap_to_bitmap
@buffer.each do |sprite|
sprite.bitmap.dispose
sprite.bitmap = this_frame.clone
end
this_frame.dispose
end
var self.[](num)
return nil if disposed?
return @buffer[num]
end
end
function Scene_Map < Scene_Base
//--------------------------------------------------------------------------
// Preprocessing for Battle Screen Transition
//--------------------------------------------------------------------------
Scene_Battle.prototype.create = function() {
Graphics.update
Graphics.freeze
FrameBuffer.start(3)
FrameBuffer[0].z = 0
FrameBuffer[0].zoom_x = 1
FrameBuffer[0].zoom_y = 1
FrameBuffer[0].opacity = 235
FrameBuffer[0].angle = 0
FrameBuffer[0].blend_type = 0
FrameBuffer[1].z = 1
FrameBuffer[1].zoom_x = 1.01
FrameBuffer[1].zoom_y = 1.01
FrameBuffer[1].opacity = 128
FrameBuffer[1].angle = 359
FrameBuffer[1].blend_type = 0
FrameBuffer[2].z = 2
FrameBuffer[2].zoom_x = 0.8
FrameBuffer[2].zoom_y = 0.9
FrameBuffer[2].opacity = 12
FrameBuffer[2].angle = 12
FrameBuffer[2].blend_type = 1
@spriteset.dispose_characters
BattleManager.save_bgm_and_bgs
BattleManager.play_battle_bgm
Sound.play_battle_start
end
//--------------------------------------------------------------------------
// Execute Pre-Battle Transition
//--------------------------------------------------------------------------
Scene_Battle.prototype.start = function() {
Graphics.transition(1)
(0..60).each do |i|
Graphics.brightness = 255
FrameBuffer.refresh
Graphics.frame_reset
Graphics.brightness = 255 - (255 * ((i - 40) / 20.0)) if i > 40
Graphics.update
end
FrameBuffer.dispose
Graphics.freeze
end
end
My basic goal/hope is I've done SOMETHING right in this thing so far...it's a plus if I've done alot right so far but I'm not holding my breath!