=begin
Event Transitions
Author: ThallionDarkshine
Instructions:
Sample Arguments for fade_out (i.e. fade_out(ONE_OF_THE_EXAMPLES[, EVENT_ID (-1 for player)])).
# Slicing Animations (Animation #0)
# parameters: (amount_movement)
[0, 40]
[0, 20]
[0, 20, [0.6]]
# Fading Animations (Animation #1)
# parameters: none
[1, 20]
[1, 30]
# Zooming Animations (Animation #2)
# parameters: (x_zoom, y_zoom) or (zoom)
[2, 30]
[2, 20, [1.2]]
[2, 30, [1, 0]]
[2, 30, [0, 1]]
[2, 30, [1.8, 0.2]]
[2, 30, [0.2, 1.8]]
[2, 30, [0.2]]
# Zooming and Spinning Animations (Animation #3)
# parameters: (x_zoom, y_zoom, spin_degrees) or (zoom, spin_degrees)
[3, 20]
[3, 40, [1.8, 0.2, 720]]
[3, 40, [0.2, 810]]
[3, 40, [0.2, 1.8, 720]]
# 3D Spin Animations (Animation #4)
# parameters: (zoom, num_rotations)
[4, 40]
[4, 40, [0, 4]]
[4, 40, [0.5, 6]]
[4, 30, [0.7, 2]]
# Shaking Animations (Animation #7)
# parameters: (x_strength, x_speed, y_strength, y_speed) or (x_intensity, y_intensity)
[7, 40]
[7, 40, [6..9, 4..7]]
# Ripple/Distort Animations (Animation #8)
# parameters: (x_amplitude, x_wavelength, num_x_ripples, y_amplitude, y_wavelength, num_y_ripples) or (x_amount, num_x_ripples, y_amount, num_y_ripples)
[8, 40]
[8, 40, [40, 10, 0.5, 10, 10, 2]]
[8, 40, [10, 10, 2, 40, 10, 0.5]]
[8, 40, [10, 40, 2, 10, 10, 2]]
[8, 40, [10, 10, 2, 10, 40, 2]]
[8, 40, [10, 10, 3, 10, 10, 2]]
[8, 40, [10, 10, 2, 10, 10, 3]]
[8, 10, [10, 40, 0.5, 10, 10, 0.5]]
[8, 10, [10, 10, 0.5, 10, 40, 0.5]]
# Dissolve to Sprite Animations (Animation #9)
# parameters: (fade_duration)
# or (fade_duration, x_size, y_size, negative?, tint_amount,
# tint_red, tint_green, tint_blue)
# or (fade_duration, x_size, y_size, negative?, tint_amount,
# tint_red, tint_green, tint_blue, grayscale_amount)
# note - use a float for x_size or y_size to specify it as a fraction
# example - 1.0 for the width of the sprite, 0.5 for half the width, and so on
[9, 40]
[9, 40, [10, 1.0, 1, false, 50, 200, 50, 50]]
[9, 40, [10, 5, 5, true, 50, 100, 200, 200]]
[9, 40, [10, 1, 1.0, false, 0, 0, 0, 0, 100]]
# Dissolve Animations (Animation #10)
[10, 40]
[10, 40, [1, 1.0]]
[10, 40, [5, 5]]
[10, 20, [10, 10]]
# Transition Graphic Animations (Animation #11)
# parameters: (transition_graphic_name, fade_duration)
# fade_duration - how long it takes for each individual pixel of the
# sprite to fade out
[11, 100]
[11, 40, ['001-Blind01', 5]]
Sample Arguments for fade_in (i.e. fade_in(ONE_OF_THE_EXAMPLES[, EVENT_ID (-1 for player)])).
# Fading Animations (Animation #0)
# parameters: none
[0, 20]
[0, 30]
# Zooming Animations (Animation #1)
# parameters: (x_zoom, y_zoom) or (zoom)
[1, 30]
[1, 20, [1.2]]
[1, 30, [1, 0]]
[1, 30, [0, 1]]
[1, 30, [1.8, 0.2]]
[1, 30, [0.2, 1.8]]
[1, 30, [0.2]]
# Zooming and Spinning Animations (Animation #2)
# parameters: (x_zoom, y_zoom, spin_degrees) or (zoom, spin_degrees)
[2, 20]
[2, 40, [1.8, 0.2, 720]]
[2, 40, [0.2, 810]]
[2, 40, [0.2, 1.8, 720]]
# 3D Spin Animations (Animation #3)
# parameters: (horizontal?, zoom, num_rotations)
[3, 40]
[3, 40, [true, 0, 4]]
[3, 40, [true, 0.5, 6]]
[3, 30, [true, 0.7, 2]]
# Shaking Animations (Animation #6)
# parameters: (x_strength, x_speed, y_strength, y_speed) or (x_intensity, y_intensity)
[6, 40]
[6, 40, [6..9, 4..7]]
# Transition Graphic Animations (Animation #7)
# parameters: (transition_graphic_name, fade_duration)
# fade_duration - how long it takes for each individual pixel of the
# sprite to fade out
[7, 100]
[7, 40, ['001-Blind01', 5]]
=end
unless Object.const_defined?(:Transitions)
raise 'This script requires ThallionDarkshine\'s Transitions Module'
end
class Interpreter
def fade_out(params, event_id = @event_id)
if event_id > 0
$game_map.events[event_id].fade_out(params)
elsif event_id == -1
$game_player.fade_out(params)
end
end
def fade_in(params, event_id = @event_id)
if event_id > 0
$game_map.events[event_id].fade_in(params)
elsif event_id == -1
$game_player.fade_in(params)
end
end
end
class Game_Character
attr_accessor :transition, :trans_dir
alias tdks_ev_trans_init initialize
def initialize(*args)
tdks_ev_trans_init(*args)
@transition = nil
@trans_dir = 0
end
def fade_out(params)
@transition = params
@trans_dir = 0
end
def fade_in(params)
@transition = params
@trans_dir = 1
end
end
class Sprite_Character
alias tdks_ev_trans_init initialize
def initialize(*args)
tdks_ev_trans_init(*args)
@visible = true
@orig_bmp = nil
@orig_state = nil
end
alias tdks_ev_trans_updt update
def update
if @visible && !Transitions.transitioning_out?(self) && !Transitions.transitioning_in?(self)
tdks_ev_trans_updt
end
if !@character.transition.nil?
if @character.trans_dir == 0
@orig_bmp = self.bitmap.clone
@orig_state = [self.zoom_x, self.zoom_y, self.opacity, self.ox, self.oy, self.angle, self.src_rect.clone]
elsif !@orig_bmp.nil?
sr = @orig_state[6]
self.bitmap = @orig_bmp.clone
self.x += @orig_state[3] - self.ox
self.y += @orig_state[4] - self.oy
self.zoom_x, self.zoom_y, self.opacity, self.ox, self.oy, self.angle = *@orig_state
self.src_rect = sr
end
@character.trans_dir == 0 ? Transitions.transition_out(self, *@character.transition) : Transitions.transition_in(self, *@character.transition)
@character.transition = nil
@visible = @character.trans_dir != 0
end
end
end