write a rpg maker mv plugin in jsscript, in pt-br, the plugin is about adding 6 types of screen transition. be long, detailed and creative, also add 6 commands that can be called ScreenTrans1, ScreenTrans2, etc...
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Aqui está o plugin para RPG Maker MV que adiciona 6 novos tipos de transições de tela. O plugin está escrito em JavaScript e os comentários estão em português brasileiro (pt-br). Cada transição é única e pode ser chamada usando os comandos de plugin ScreenTrans1, ScreenTrans2, etc.
Plugin: TransiçõesPersonalizadas.js
javascript
/*:
* @plugindesc [PT-BR] Adiciona 6 novos tipos de transições de tela ao jogo.
* @author SeuNome
*
* @param Cor Fade Transição 1
* @text Cor do Fade (Transição 1)
* @desc Cor utilizada na transição 1 (formato RGB separado por vírgulas, ex: 255,0,0)
* @default 255,0,0
*
* @help
* ============================================================================
* Descrição
* ============================================================================
*
* Este plugin adiciona 6 novos tipos de transições de tela que podem ser
* chamadas através de comandos de plugin.
*
* ============================================================================
* Comandos de Plugin
* ============================================================================
*
* ScreenTrans1
* Executa a Transição de Tela 1 (Fade Colorido).
*
* ScreenTrans2
* Executa a Transição de Tela 2 (Deslizar para a Esquerda).
*
* ScreenTrans3
* Executa a Transição de Tela 3 (Zoom In).
*
* ScreenTrans4
* Executa a Transição de Tela 4 (Efeito de Pixelização).
*
* ScreenTrans5
* Executa a Transição de Tela 5 (Cortina Vertical).
*
* ScreenTrans6
* Executa a Transição de Tela 6 (Rotação).
*
* ============================================================================
* Instruções
* ============================================================================
*
* Para utilizar as transições, insira o comando de plugin correspondente
* no evento desejado.
*
* Exemplo:
* Comando de Plugin: ScreenTrans1
*
* ============================================================================
* Termos de Uso
* ============================================================================
*
* Livre para uso em projetos comerciais e não comerciais, com créditos
* ao autor.
*/
(function() {
// Obter parâmetros do plugin
var parameters = PluginManager.parameters('TransiçõesPersonalizadas');
var colorFadeTrans1 = parameters['Cor Fade Transição 1'] || '255,0,0';
var colorValues = colorFadeTrans1.split(',').map(Number);
// Alias do método original pluginCommand
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
// Extensão do método pluginCommand para adicionar novos comandos
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args);
// Verifica qual comando foi chamado e executa a transição correspondente
if (command === 'ScreenTrans1') {
SceneManager.push(Scene_ScreenTrans1);
} else if (command === 'ScreenTrans2') {
SceneManager.push(Scene_ScreenTrans2);
} else if (command === 'ScreenTrans3') {
SceneManager.push(Scene_ScreenTrans3);
} else if (command === 'ScreenTrans4') {
SceneManager.push(Scene_ScreenTrans4);
} else if (command === 'ScreenTrans5') {
SceneManager.push(Scene_ScreenTrans5);
} else if (command === 'ScreenTrans6') {
SceneManager.push(Scene_ScreenTrans6);
}
};
// =========================================================================
// Transição 1: Fade Colorido
// =========================================================================
// Criação da cena para a Transição 1
function Scene_ScreenTrans1() {
this.initialize.apply(this, arguments);
}
Scene_ScreenTrans1.prototype = Object.create(Scene_Base.prototype);
Scene_ScreenTrans1.prototype.constructor = Scene_ScreenTrans1;
// Inicialização da cena
Scene_ScreenTrans1.prototype.initialize = function() {
Scene_Base.prototype.initialize.call(this);
};
// Criação dos elementos da cena
Scene_ScreenTrans1.prototype.create = function() {
Scene_Base.prototype.create.call(this);
// Cria um sprite que cobre a tela com a cor especificada
this._fadeSprite = new ScreenSprite();
this._fadeSprite.setColor(colorValues[0], colorValues[1], colorValues[2]);
this._fadeSprite.opacity = 0; // Começa transparente
this.addChild(this._fadeSprite);
};
// Início da transição
Scene_ScreenTrans1.prototype.start = function() {
Scene_Base.prototype.start.call(this);
this._fadeOut = true; // Inicia o fade out
};
// Atualização da cena a cada frame
Scene_ScreenTrans1.prototype.update = function() {
Scene_Base.prototype.update.call(this);
if (this._fadeOut) {
this._fadeSprite.opacity += 10; // Aumenta a opacidade para criar o fade out
if (this._fadeSprite.opacity >= 255) {
this._fadeOut = false;
this._fadeIn = true;
// Aqui você pode trocar a cena ou executar ações necessárias
// Exemplo: Transferir o jogador para um novo mapa
// $gamePlayer.reserveTransfer(idDoMapa, x, y, direção)
// SceneManager.goto(Scene_Map);
// Para este exemplo, simplesmente retornaremos à cena do mapa
SceneManager.goto(Scene_Map);
}
} else if (this._fadeIn) {
this._fadeSprite.opacity -= 10; // Diminui a opacidade para criar o fade in
if (this._fadeSprite.opacity <= 0) {
this._fadeIn = false;
this.popScene(); // Remove esta cena da pilha
}
}
};
// =========================================================================
// Transição 2: Deslizar para a Esquerda
// =========================================================================
function Scene_ScreenTrans2() {
this.initialize.apply(this, arguments);
}
Scene_ScreenTrans2.prototype = Object.create(Scene_Base.prototype);
Scene_ScreenTrans2.prototype.constructor = Scene_ScreenTrans2;
Scene_ScreenTrans2.prototype.initialize = function() {
Scene_Base.prototype.initialize.call(this);
};
Scene_ScreenTrans2.prototype.create = function() {
Scene_Base.prototype.create.call(this);
// Captura uma imagem da tela atual
this._snapshot = SceneManager.snap();
this._snapshot.x = 0;
this.addChild(this._snapshot);
};
Scene_ScreenTrans2.prototype.start = function() {
Scene_Base.prototype.start.call(this);
this._slideOut = true; // Inicia o movimento de deslizar
};
Scene_ScreenTrans2.prototype.update = function() {
Scene_Base.prototype.update.call(this);
if (this._slideOut) {
this._snapshot.x -= 15; // Move a imagem para a esquerda
if (this._snapshot.x <= -Graphics.width) {
this._slideOut = false;
// Troca para a cena desejada (neste caso, o mapa)
SceneManager.goto(Scene_Map);
// Captura a nova tela após a troca de cena
this._newSnapshot = SceneManager.snap();
this._newSnapshot.x = Graphics.width; // Começa fora da tela, à direita
this.addChild(this._newSnapshot);
this._slideIn = true; // Inicia o movimento de entrada
}
} else if (this._slideIn) {
this._newSnapshot.x -= 15; // Move a nova imagem para a esquerda
if (this._newSnapshot.x <= 0) {
this._slideIn = false;
this.popScene(); // Remove a cena de transição
}
}
};
// =========================================================================
// Transição 3: Zoom In
// =========================================================================
function Scene_ScreenTrans3() {
this.initialize.apply(this, arguments);
}
Scene_ScreenTrans3.prototype = Object.create(Scene_Base.prototype);
Scene_ScreenTrans3.prototype.constructor = Scene_ScreenTrans3;
Scene_ScreenTrans3.prototype.initialize = function() {
Scene_Base.prototype.initialize.call(this);
};
Scene_ScreenTrans3.prototype.create = function() {
Scene_Base.prototype.create.call(this);
// Captura uma imagem da tela atual
this._snapshot = SceneManager.snap();
this._snapshot.scale.x = 1;
this._snapshot.scale.y = 1;
this._snapshot.anchor.x = 0.5;
this._snapshot.anchor.y = 0.5;
this._snapshot.x = Graphics.width / 2;
this._snapshot.y = Graphics.height / 2;
this.addChild(this._snapshot);
};
Scene_ScreenTrans3.prototype.start = function() {
Scene_Base.prototype.start.call(this);
this._zoomOut = true; // Inicia o zoom out
};
Scene_ScreenTrans3.prototype.update = function() {
Scene_Base.prototype.update.call(this);
if (this._zoomOut) {
this._snapshot.scale.x += 0.05;
this._snapshot.scale.y += 0.05;
this._snapshot.opacity -= 5;
if (this._snapshot.opacity <= 0) {
this._zoomOut = false;
// Troca para a cena desejada
SceneManager.goto(Scene_Map);
// Captura a nova tela
this._newSnapshot = SceneManager.snap();
this._newSnapshot.scale.x = 1.5;
this._newSnapshot.scale.y = 1.5;
this._newSnapshot.anchor.x = 0.5;
this._newSnapshot.anchor.y = 0.5;
this._newSnapshot.x = Graphics.width / 2;
this._newSnapshot.y = Graphics.height / 2;
this._newSnapshot.opacity = 0;
this.addChild(this._newSnapshot);
this._zoomIn = true; // Inicia o zoom in
}
} else if (this._zoomIn) {
this._newSnapshot.scale.x -= 0.05;
this._newSnapshot.scale.y -= 0.05;
this._newSnapshot.opacity += 5;
if (this._newSnapshot.scale.x <= 1) {
this._zoomIn = false;
this.popScene();
}
}
};
// =========================================================================
// Transição 4: Efeito de Pixelização
// =========================================================================
function Scene_ScreenTrans4() {
this.initialize.apply(this, arguments);
}
Scene_ScreenTrans4.prototype = Object.create(Scene_Base.prototype);
Scene_ScreenTrans4.prototype.constructor = Scene_ScreenTrans4;
Scene_ScreenTrans4.prototype.initialize = function() {
Scene_Base.prototype.initialize.call(this);
};
Scene_ScreenTrans4.prototype.create = function() {
Scene_Base.prototype.create.call(this);
// Captura uma imagem da tela atual
this._snapshot = SceneManager.snap();
// Adiciona o filtro de pixelização
this._snapshot.filters = [new PIXI.filters.PixelateFilter(1)];
this.addChild(this._snapshot);
this._pixelate = this._snapshot.filters[0];
};
Scene_ScreenTrans4.prototype.start = function() {
Scene_Base.prototype.start.call(this);
this._pixelateOut = true; // Inicia o efeito de pixelização
this._pixelSize = 1;
};
Scene_ScreenTrans4.prototype.update = function() {
Scene_Base.prototype.update.call(this);
if (this._pixelateOut) {
this._pixelSize += 1;
this._pixelate.size.x = this._pixelSize;
this._pixelate.size.y = this._pixelSize;
if (this._pixelSize >= 50) {
this._pixelateOut = false;
// Troca para a cena desejada
SceneManager.goto(Scene_Map);
// Aplica o efeito inverso na nova cena
this._newSnapshot = SceneManager.snap();
this._newSnapshot.filters = [new PIXI.filters.PixelateFilter(50)];
this.addChild(this._newSnapshot);
this._pixelateIn = true; // Inicia o efeito de despixelização
}
} else if (this._pixelateIn) {
this._pixelSize -= 1;
this._newSnapshot.filters[0].size.x = this._pixelSize;
this._newSnapshot.filters[0].size.y = this._pixelSize;
if (this._pixelSize <= 1) {
this._pixelateIn = false;
this.popScene();
}
}
};
// =========================================================================
// Transição 5: Cortina Vertical
// =========================================================================
function Scene_ScreenTrans5() {
this.initialize.apply(this, arguments);
}
Scene_ScreenTrans5.prototype = Object.create(Scene_Base.prototype);
Scene_ScreenTrans5.prototype.constructor = Scene_ScreenTrans5;
Scene_ScreenTrans5.prototype.initialize = function() {
Scene_Base.prototype.initialize.call(this);
};
Scene_ScreenTrans5.prototype.create = function() {
Scene_Base.prototype.create.call(this);
// Cria duas sprites cobrindo cada metade da tela
this._leftCurtain = new Sprite();
this._leftCurtain.bitmap = SceneManager.snap();
this._leftCurtain.setFrame(0, 0, Graphics.width / 2, Graphics.height);
this._leftCurtain.x = 0;
this.addChild(this._leftCurtain);
this._rightCurtain = new Sprite();
this._rightCurtain.bitmap = SceneManager.snap();
this._rightCurtain.setFrame(Graphics.width / 2, 0, Graphics.width / 2, Graphics.height);
this._rightCurtain.x = Graphics.width / 2;
this.addChild(this._rightCurtain);
};
Scene_ScreenTrans5.prototype.start = function() {
Scene_Base.prototype.start.call(this);
this._curtainClose = true; // Inicia o fechamento das cortinas
};
Scene_ScreenTrans5.prototype.update = function() {
Scene_Base.prototype.update.call(this);
if (this._curtainClose) {
this._leftCurtain.x -= 10;
this._rightCurtain.x += 10;
if (this._leftCurtain.x + this._leftCurtain.width <= Graphics.width / 2) {
this._curtainClose = false;
// Troca para a cena desejada
SceneManager.goto(Scene_Map);
// Reposiciona as cortinas para o efeito inverso
this._leftCurtain.x = -this._leftCurtain.width;
this._rightCurtain.x = Graphics.width;
this._curtainOpen = true; // Inicia a abertura das cortinas
}
} else if (this._curtainOpen) {
this._leftCurtain.x += 10;
this._rightCurtain.x -= 10;
if (this._leftCurtain.x >= 0) {
this._curtainOpen = false;
this.popScene();
}
}
};
// =========================================================================
// Transição 6: Rotação
// =========================================================================
function Scene_ScreenTrans6() {
this.initialize.apply(this, arguments);
}
Scene_ScreenTrans6.prototype = Object.create(Scene_Base.prototype);
Scene_ScreenTrans6.prototype.constructor = Scene_ScreenTrans6;
Scene_ScreenTrans6.prototype.initialize = function() {
Scene_Base.prototype.initialize.call(this);
};
Scene_ScreenTrans6.prototype.create = function() {
Scene_Base.prototype.create.call(this);
// Captura um snapshot da tela atual
this._snapshot = SceneManager.snap();
this._snapshot.anchor.x = 0.5;
this._snapshot.anchor.y = 0.5;
this._snapshot.x = Graphics.width / 2;
this._snapshot.y = Graphics.height / 2;
this.addChild(this._snapshot);
};
Scene_ScreenTrans6.prototype.start = function() {
Scene_Base.prototype.start.call(this);
this._rotateOut = true; // Inicia a rotação
};
Scene_ScreenTrans6.prototype.update = function() {
Scene_Base.prototype.update.call(this);
if (this._rotateOut) {
this._snapshot.rotation += 0.1;
this._snapshot.opacity -= 5;
if (this._snapshot.opacity <= 0) {
this._rotateOut = false;
// Troca para a cena desejada
SceneManager.goto(Scene_Map);
// Prepara o efeito de rotação inversa
this._newSnapshot = SceneManager.snap();
this._newSnapshot.anchor.x = 0.5;
this._newSnapshot.anchor.y = 0.5;
this._newSnapshot.x = Graphics.width / 2;
this._newSnapshot.y = Graphics.height / 2;
this._newSnapshot.rotation = Math.PI * 2; // 360 graus
this._newSnapshot.opacity = 0;
this.addChild(this._newSnapshot);
this._rotateIn = true; // Inicia a rotação inversa
}
} else if (this._rotateIn) {
this._newSnapshot.rotation -= 0.1;
this._newSnapshot.opacity += 5;
if (this._newSnapshot.rotation <= 0) {
this._rotateIn = false;
this.popScene();
}
}
};
})();
Como usar:
Copie o código acima e cole em um arquivo de texto.
Salve o arquivo com o nome TransiçõesPersonalizadas.js.
Coloque o arquivo na pasta js/plugins do seu projeto RPG Maker MV.
No editor do RPG Maker MV, abra o Gerenciador de Plugins.
Adicione o plugin TransiçõesPersonalizadas e certifique-se de que está ativado.
Nos eventos onde você deseja usar as transições, use o comando de plugin correspondente (por exemplo, ScreenTrans1).
Observações:
Você pode ajustar as cores e velocidades diretamente no código ou, para a Transição 1, alterar o parâmetro do plugin para definir a cor desejada.
As transições estão programadas para retornar ao mapa atual ou iniciar um novo jogo. Você pode personalizar as ações dentro das transições para atender às necessidades do seu projeto.
As transições utilizam efeitos como fade, movimento, zoom, pixelização, cortinas e rotação para criar diferentes experiências visuais.