🤔 Para Refletir : "Saber a hora de parar é quase tão importante quanto saber a hora de começar" - Ricky O Bardo

[RPGMV] Como fechar uma cena criada por script.

Membro Membro
Postagens
27
Bravecoins
20
Engine: Rpg maker MV
Estou com um problema relacionado com script.
Neste script ele printa na tela o rank do jogador

Meu problema é relacionado a usar esse script na versão para celulares, por algum motivo ele não passa dessa tela de rank.
Na versão de PC basta o usuario apertar Z para a finalizar a cena.

Então gostaria de saber se existe alguma solução, eu pensei em a cena fechar automaticamente apos alguns segundos ou criar um botão nessa cena para fecha-lá, porém não sei como fazer isso.

Script:
Código:
function Scene_Nome() {
  this.initialize.apply(this, arguments);
};

Scene_Nome.prototype = Object.create(Scene_Base.prototype);
Scene_Nome.prototype.constructor = Scene_Nome;

Scene_Nome.prototype.initialize = function() {
  Scene_Base.prototype.initialize.call(this);
};


Scene_Boot.prototype.loadMyImages = function() {
	ImageManager.loadPicture('Score art');
};

Scene_Nome.prototype.create = function() {
  Scene_Base.prototype.create.call(this);
  this.createWindowLayer();
	this.createWindow();
};

Scene_Nome.prototype.createWindow = function() {
	this._nomeWindow = new Window_Nome();
	this.addWindow(this._nomeWindow);
};

Scene_Nome.prototype.update = function() {
	Scene_Base.prototype.update.call(this);
	if (Input.isTriggered('ok')) {
		this.popScene();
	};
};

function Window_Nome() {
  this.initialize.apply(this, arguments);
};

Window_Nome.prototype = Object.create(Window_Base.prototype);
Window_Nome.prototype.constructor = Window_Nome;

Window_Nome.prototype.initialize = function() {
  Window_Base.prototype.initialize.call(this, 0, 0, Graphics.boxWidth, Graphics.boxHeight);
  this.refresh();
};

Window_Base.prototype.drawPicture = function(imageName, x,y) {
    var bitmap = ImageManager.loadPicture(imageName);
    var pw = bitmap.width;
    var ph = bitmap.height;
    var sx = 0;
    var sy = 0;
    this.contents.blt(bitmap, sx, sy, pw, ph, x, y);

};

Window_Nome.prototype.refresh = function() {


this.drawPicture("Score art", 0, 0);

this.drawText("Boss Derrotados ", 242, 152, this.contentsWidth(), 'left');
this.drawText(" " + $gameVariables.value(22) + " / 5", 305, 190, this.contentsWidth(), 'left');

this.drawText("Tesouros Encontrados", 770,152, this.contentsWidth(), 'left');
this.drawText("" + $gameVariables.value(23) + " / 10", 842, 190, this.contentsWidth(), 'left');

this.drawText("Zonas Secretas", 252, 433, this.contentsWidth(), 'left');
this.drawText(" " + $gameVariables.value(24) + " / 2", 305, 470, this.contentsWidth(), 'left');

this.drawText("Heroes Encontrados", 800, 430, this.contentsWidth(), 'left');
this.drawText(" " + $gameVariables.value(26) + " / 5", 850, 470, this.contentsWidth(), 'left');

this.drawText("Tempo de jogo", 545, 598, this.contentsWidth(), 'left');
this.drawText("" +  $gameSystem.playtimeText() + "", 550, 565, this.contentsWidth(), 'left');

this.drawText("Rank ", 575, 55, this.contentsWidth(), 'left');
this.drawText(" " + $gameVariables.value(30) + " / 100", 535, 95, this.contentsWidth(), 'left');
this.changeTextColor(this.textColor(10));
this.drawText("Dificuldade: " + $gameVariables.value(34) + " ", 70, 40, this.contentsWidth(), 'left');

};
 
Rapaz, não tenho celular pra testar isso e te ajudar. =/

Meu palpite é que o código padrão da tecla Z funcione diferente no celular, por isso não reconhece os comandos.

Já tentou conferir isso nos scripts padrões do Maker?
 
CleanWater comentou:
Rapaz, não tenho celular pra testar isso e te ajudar. =/

Meu palpite é que o código padrão da tecla Z funcione diferente no celular, por isso não reconhece os comandos.

Já tentou conferir isso nos scripts padrões do Maker?


Não achei nada que me ajude até agora, to na esperança de achar um comando em javascript que feche a cena apos algum tempo.
 
Substitui a função Input.isTriggered por TouchInput.isTriggered()

Código:
Scene_Nome.prototype.update = function() {
	Scene_Base.prototype.update.call(this);
	if (TouchInput.isTriggered()) {
		this.popScene();
	}
};

Pode fechar o topico
 
SoyeR comentou:
Substitui a função Input.isTriggered por TouchInput.isTriggered()

Código:
Scene_Nome.prototype.update = function() {
	Scene_Base.prototype.update.call(this);
	if (TouchInput.isTriggered()) {
		this.popScene();
	}
};

Pode fechar o topico

Haha! Sabia que era algo assim. Inclusive, você pode incluir isso no mesmo bloco do "Input.isTriggered" pra funcionar em ambos PC e Mobile. :awesome:

Código:
Scene_Nome.prototype.update = function() {
	Scene_Base.prototype.update.call(this);
	//Fecha no Mobile
        if (TouchInput.isTriggered()) {
		this.popScene();
	}
        //Fecha no PC
        if (Input.isTriggered()) {
		this.popScene();
	}
}
 
Voltar
Topo