POR: Alex Crosslight
3 transições de batalha dinâmicas.
> Cole o script de transição acima do main e o habilite da maneira desejada. Não se esqueça de colar também o script requesitado para que tenha total funcionamento do efeito.
> Cole também a dll screenshot que pode ser baixada aqui na pasta de seu projeto (Onde fica o game.exe).
Zé Colméia pelos seus excelentes scripts de efeito Wave e rotate sprite, os quais foram essenciais para criar as transições.
Andreas21 e CyberSam por criarem a função screenshot.
Criado por Alexander Ernest Crosslight.
TRANSIÇÕES DE BATALHA
Por Alex Crosslight
INTRODUÇÃO
Para comemorar o meu aniversário, criei esse script que propõe três diferentes transições dinâmicas de batalha, todas feitas com ajuda de artefatos que encontrei net a fora.Por Alex Crosslight
INTRODUÇÃO
DESCRIÇÃO
3 transições de batalha dinâmicas.
DEMO
Não necessária
SCRIPTS
Cada transição necessita de um script para seu funcionamento.Não necessária
SCRIPTS
- Código:
#==================================
# Cross Transition battle
#==================================
# Por Alex Crosslight
#==================================
# Para comemorar o meu aniversário, estou trazendo esse
# script o qual trabalhei em cima de algumas das mil engenhocas
# do meu amigo Zé Colméia e de mais alguns scripters net a fora.
#
# O script possibilita tipos de transições para inicio de batalha,
# todas fazendo algum efeito dinâmico.
#
# É necessário a dll screenshot instalada no diretório de seu projeto.
#
#
# ID da transição:
#
# 1 - Flip: Faz um giro do mapa que dá lugar ao fundo de batalha.
# 2 - Efeito Wave: o mapa se distorçe e dá lugar ao fundo de batalha.
# 3 - Derramamento: o mapa perde opacidade aos poucos e é "derramado" na tela.
#
# Para o efeito 1, é necessária a presença do script Rotate Sprite, por zé colméia.
# Para o efeito 2, é necessária a presença do script Wave Effect, por Zé Colméia.
# Para o efeito 3, é necessária a presença dos scritps Rotate Sprite por Zé Colméia.
#==================================
module Cross
ID_TRANSITION = 3 # ID da transição (Lista acima)
BATTLEBACK_AP = true # mostrar battleback de fundo durante a ação? Se sim,
# ao invés do fundo ficar preto, ele ja mostra o
# battleback atual.
#-------------------------
# Os efeitos 1 e 3 só são habilitados caso BATTLEBACL_AP = true.
#-------------------------
end
#===============================================================================
#Permite que você adicione a função screenshot, aperte o botão
#F5 para capturar a imagem, é necessário o arquivo screenshot.dll
#################################################################
# Screenshot V2
# Screenshot Script v1 & screenshot.dll v1 created by: Andreas21
# Screenshot Script v2 created/edit by: cybersam
#===============================================================================
module Screen
@screen = Win32API.new 'screenshot', 'Screenshot', %w(l l l l p l l), ''
@readini = Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l'
@findwindow = Win32API.new 'user32', 'FindWindowA', %w(p p), 'l'
module_function
def shot(file = "screenshot", typ = 2)
if typ == 0
typname = ".bmp"
elsif typ == 1
typname = ".jpg"
elsif typ == 2
typname = ".png"
end
file_index = 0
dir = "Graphics/Pictures/"
file_name = dir + file.to_s + typname.to_s
@screen.call(0,0,640,480,file_name,handel,typ)
end
def handel
game_name = "\0" * 256
@readini.call('Game','Title','',game_name,255,".\\Game.ini")
game_name.delete!("\0")
return @findwindow.call('RGSS Player',game_name)
end
end
#===============
# Inicio do script.
#===============
class Scene_Map
def call_battle
# Limpar flag de chamada de batalha
$game_temp.battle_calling = false
# Limpar flag de chamda de menu
$game_temp.menu_calling = false
$game_temp.menu_beep = false
# Criar um contador de encontros
$game_player.make_encounter_count
# Memmorizar a BGM do mapa e parar a BGM
$game_temp.map_bgm = $game_system.playing_bgm
$game_system.bgm_stop
# Reproduzir SE de Batalha
$game_system.se_play($data_system.battle_start_se)
# Reproduzir BGM de Batalha
$game_system.bgm_play($game_system.battle_bgm)
# Alinhar a posição do Jogador
$game_player.straighten
# Alternar para a tela de Batalha
$scene = Scene_Teste.new
end
end
class Scene_Teste
def main
Screen::shot
@raver = 0
case Cross::ID_TRANSITION
when 1
@sprite1 = Rotate.new
@sprite1.mirror2 = false
@sprite1.ppf = 20
@sprite1.x2 = 0
@sprite1.y = 0
@sprite1.angle = 0
@sprite1.zoom_x2 = 1
@sprite1.zoom_y = 1
@sprite1.bitmap = RPG::Cache.picture("screenshot")
@sprite1.bitmap2 = RPG::Cache.battleback($game_map.battleback_name) if Cross::BATTLEBACK_AP
when 2
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.battleback($game_map.battleback_name) if Cross::BATTLEBACK_AP
@sprite1 = Sprite.new
@sprite1.bitmap = RPG::Cache.picture("screenshot")
@sprite1.x = 0
@sprite1.wave_amp = 30
@sprite1.wave_length = 120
@sprite1.wave_phase = 90
@sprite1.wave_speed = 60
when 3
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.battleback($game_map.battleback_name) if Cross::BATTLEBACK_AP
@sprite1 = Rotate.new
@sprite1.x2 = 5
@sprite1.y = 0
@sprite1.zoom_x2 = 1
@sprite1.zoom_y = 1
@sprite1.bitmap = RPG::Cache.picture("screenshot")
when 4
@sprite1 = Rotate.new
@sprite1.x = 0
@sprite1.y = 0
@sprite1.angle = 0
@sprite1.bitmap = RPG::Cache.picture("screenshot")
end
# Executar transição
Graphics.transition
# Loop principal
loop do
# Atualizar a tela de jogo
Graphics.update
# Atualizar a entrada de informações
Input.update
# Atualizar Frame
update
# Abortar loop se a tela for alterada
if $scene != self
break
end
end
# Preparar para transiçõa
Graphics.freeze
@sprite.dispose if Cross::ID_TRANSITION == 2
@sprite.dispose if Cross::ID_TRANSITION == 3
@sprite1.bitmap.dispose
@sprite1.dispose
end
def update
@sprite1.update
if Cross::ID_TRANSITION == 2
@sprite1.x -= 10
@sprite1.opacity -= 5
@sprite1.wave_amp += 10
@sprite1.wave_length += 10
@sprite1.wave_phase += 20
@sprite1.wave_speed += 20
end
if Cross::ID_TRANSITION == 3
@sprite1.zoom_x2 += 0.5
@sprite1.zoom_y += 0.5
@sprite1.opacity -= 5
end
if Cross::ID_TRANSITION == 4
@sprite1.angle += 10
@sprite1.x += 50
@sprite1.y += 50
end
@raver += 10
if @raver > 630
File.delete("Graphics/Pictures/screenshot.png")
$scene = Scene_Battle.new
end
end
end
- Spoiler:
- Código:
#========================================
# XP Wave Effect
#----------------------------------------
#by: zecomeia
#date: 01/03/2010
#for: RGSS
#version: 1.0
#www.colmeia-do-ze.blogspot.com
#----------------------------------------
=begin
Reproduction of the VX's wave effect
(see the help file of the RPGMaker VX
in the RGSS manual reference topic)
=end
#==============#
# Sprite class #
#==============#
class Sprite
include Math
attr_accessor :wave_amp
attr_accessor :wave_length
attr_accessor :wave_speed
attr_accessor :wave_phase
attr_accessor :temp_bitmap
alias initialize default_initialize rescue nil
alias default_initialize initialize
def initialize(viewport=nil)
@wave_amp = 0
@wave_length = 180
@wave_speed = 360
@wave_phase = 0.0
default_initialize(viewport)
@temp_bitmap = nil
end
alias update default_update rescue nil
alias default_update update
def update()
# the wave effect only works if wave_amp
# propertie is a number more than zero
wave_effect if @wave_amp > 0
default_update()
end
# Return the width of image, because when use
# obj.bitmap.width the value will be more than
# the original value(because effect)
def width()
return (self.bitmap.width - @wave_amp * 2)
end
#---------------
# Wave Effect
#---------------
def wave_effect()
return if self.bitmap.nil?
@temp_bitmap = self.bitmap if @temp_bitmap.nil?
cw = @temp_bitmap.width + (@wave_amp * 2)
ch = @temp_bitmap.height
# Follow the VX wave effect, each horizontal line
# has 8 pixel of height. This device provides less
# lag in game.
divisions = @temp_bitmap.height / 8
divisions += 1 if @temp_bitmap.height % 8 != 0
self.bitmap = Bitmap.new(cw, ch)
for i in 0..divisions
x = @wave_amp * Math.sin(i * 2 * PI / (@wave_length / 8).to_i + Math.deg_to_rad(@wave_phase))
src_rect = Rect.new(0, i*8, @temp_bitmap.width, 8)
dest_rect = Rect.new(@wave_amp + x, i * 8, @temp_bitmap.width, 8)
self.bitmap.stretch_blt(dest_rect, @temp_bitmap, src_rect)
end
# frame rate: VX = 60 | XP = 40
# wave speed compatibility VX to XP: wave_speed * 60/40
# then: wave_speed * 1.5
@wave_phase += @wave_speed * 1.5 / @wave_length
@wave_phase -= 360 if @wave_phase > 360
@wave_phase += 360 if @wave_phase < 0
end
end
#=============#
# module Math #
#=============#
module Math
#-------------------------------
# Conversion Degree to Radian
#-------------------------------
def Math.deg_to_rad(deg)
return (deg * PI) / 180.0
end
end
- Spoiler:
- Código:
#======================================
# C-RS(Colméia - Rotate Sprite)
#--------------------------------------
#by: zecomeia
#date: 20/12/2009
#for: RGSS and RGSS2
#http://colmeia-do-ze.blogspot.com
#--------------------------------------
=begin
updates:
------------------------------------------------
>>>>>[31/01/2010]<<<<<
- Now the script uses the Sprite class as
superclass instead of changing it.
- The property "not_reverse" now called
"mirror2", and its operation is the reverse of
what it was.
- Added the property "x2", "ox2" and "zoom_x2"
to replace the properties "x", "ox" and "zoom_x"
because they are used to cause the effect of the
script, and thus preventing change them.
------------------------------------------------
about the script:
-------------------------------------------------
A class that inherits from the Sprite class that
adds the effects of rotation on the images giving
the impression the image has depth.
-------------------------------------------------
manual:
---------------------------------------------
self.bitmap2: back image for effect.
Is a Bitmap object
self.mirro2: if true,
the back image will be draw flip
horizontally, if false(default), not.
Is a Boolean type
self.ppf: "pixels per frame" define
the velocity of the effect.
Is a Integer object
self.x2 = X coordenate of sprite
Is a Integer object
self.ox2 = X coordenate of the sprite's origin
Is a Integer object
self.zoom_x2 = horizontal zoom on the sprite
1=100%
Is a Integer object
----------------------------------------------
=end
#======================================
class Rotate < Sprite
attr_accessor :bitmap2
attr_accessor :mirror2
attr_accessor :ppf
attr_accessor :x2
attr_accessor :ox2
attr_accessor :zoom_x2
def initialize(viewport=nil)
@bitmap2 = nil
@mirror2 = false
@ppf = 0
@x2 = 0
@ox2 = 0
@zoom_x2 = 1
@rotate = false
@stage = true
super(viewport)
end
def bitmap2=(bitmap2)
@bitmap2=bitmap2
self.ox = @ox2 + self.bitmap.width.to_f/2
self.x = @x2 + self.bitmap.width.to_f/2
self.zoom_x = @zoom_x2
end
def update
super
rotate() unless @bitmap2.nil?
end
def rotate()
@img_front = bitmap if @img_front.nil?
if self.zoom_x <= 0 && @stage == true
if @rotate == false
@rotate = true
self.mirror = true if @mirror2 == true
self.bitmap = @bitmap2
else
@rotate = false
self.mirror = false if @mirror2 == true
self.bitmap = @img_front
end
@stage = false
elsif self.zoom_x >= @zoom_x2 && @stage == false
@stage = true
end
self.ox = @ox2 + self.bitmap.width.to_f/2
self.x = @x2 + self.bitmap.width.to_f/2
[email=self.zoom_x-=@ppf/self.bitmap.width.to_f]self.zoom_x-=@ppf/self.bitmap.width.to_f[/email] if @stage == true
[email=self.zoom_x+=@ppf/self.bitmap.width.to_f]self.zoom_x+=@ppf/self.bitmap.width.to_f[/email] if @stage == false
end
end
INSTRUÇÕES
> Cole o script de transição acima do main e o habilite da maneira desejada. Não se esqueça de colar também o script requesitado para que tenha total funcionamento do efeito.
> Cole também a dll screenshot que pode ser baixada aqui na pasta de seu projeto (Onde fica o game.exe).
IMAGENS
AGRADECIMENTOS
AGRADECIMENTOS
Zé Colméia pelos seus excelentes scripts de efeito Wave e rotate sprite, os quais foram essenciais para criar as transições.
Andreas21 e CyberSam por criarem a função screenshot.
Criado por Alexander Ernest Crosslight.