Unlimited and Optimized Pictures handle
IntroduçãoEstas são apenas algumas modificações nos scripts originais.
RecursosRemove a criação automática ao iniciar e passa a criar imagens dinamicamente, e quando o "erase Picture" é chamado, apaga também o objeto.
Isto não cria objeto com valores vazios, apenas aloca as imagens que forem utilizadas, e remove as que forem apagadas.
Então, mesmo se usar "$gameScreen.showPicture(9999999,"Image_Name", 0, x, y, 100, 100, 255, 0);" não vai fazer com que o tamanho da variável seja 9999999.
Como usarApenas salve o codigo com a extensão .js e adicione ao seu projeto.
ComandosOs mesmo originais da engine.
Como a engine tem um limite de 100, utilize "Show Picture", use a função "$gameScreen.showPicture".
Exemplo:
$gameScreen.showPicture(
id, name, origin, x, y, scaleX, scaleY, opacity, blendMode);
//Like
$gameScreen.showPicture(9999999,"Image_Name", 0, x, y, 100, 100, 255, 0);
Você pode utilizar o que quiser como id.
Tipo:
$gameScreen.showPicture("Nun","People2_6", 1, 0, 0, 100, 100, 255, 0);
$gameScreen.showPicture("Doggy","Nature_1", 1, 0, 0, 100, 100, 255, 0);
Script$gameScreen.showPicture(
id, name, origin, x, y, scaleX, scaleY, opacity, blendMode);
//Like
$gameScreen.showPicture(9999999,"Image_Name", 0, x, y, 100, 100, 255, 0);
Script
var ImageController = undefined;
Game_Screen.prototype.maxPictures = function() {
return 0; // Added Line to remove the auto created pictures object
};
Spriteset_Base.prototype.initialize = function() {
Sprite.prototype.initialize.call(this);
this.setFrame(0, 0, Graphics.width, Graphics.height);
this.loadSystemImages();
this.createLowerLayer();
this.createUpperLayer();
this._animationSprites = [];
ImageController = this; //Added line only to set the ImageController variable
};
Game_Screen.prototype.showPicture = function(pictureId, name, origin, x, y, scaleX, scaleY, opacity, blendMode) {
const realPictureId = this.realPictureId(pictureId);
if(ImageController._pictureContainer.children.find(picture => picture._pictureId == realPictureId) == undefined) {//Added line to check if the picture already exist
ImageController._pictureContainer.addChild(new Sprite_Picture(realPictureId)) //Added line to create the picture object and add it to the container
const picture = new Game_Picture();
picture.show(name, origin, x, y, scaleX, scaleY, opacity, blendMode);
picture.id = realPictureId;
if(this._pictures.length > 0)
{
const ThisPictureIndex = this._pictures.indexOf(this._pictures.find(picture => picture === undefined));
if(ThisPictureIndex != -1) {
this._pictures[ThisPictureIndex] = picture;
return;
} else {
this._pictures.push(picture);
return;
}
}
else
this._pictures.push(picture)
} else {
$gameScreen.erasePicture(realPictureId);
$gameScreen.showPicture(pictureId, name, origin, x, y, scaleX, scaleY, opacity, blendMode);
}
};
Game_Screen.prototype.picture = function(pictureId) {
const realPictureId = this.realPictureId(pictureId);
return this._pictures.find(function(picture) {
if(picture)
return picture.id === realPictureId
else
return false;
});
};
Sprite_Picture.prototype.remove = function() {
this.parent.removeChild(this);
};
Game_Screen.prototype.erasePicture = function(pictureId) {
const realPictureId = this.realPictureId(pictureId);
this._pictures[this._pictures.indexOf($gameScreen.picture(realPictureId))] = undefined;
//this._pictures[realPictureId] = null;
const picture = ImageController._pictureContainer.children.find(picture => picture._pictureId == realPictureId);
if(picture)
picture.remove(); //Added line to remove the picture object from the container
};
Game_Screen.prototype.realPictureId = function(pictureId) {
return pictureId; //This was changed to only return the same pictureId inserted, function was not removed to keep compatibility with other plugins
};
Termos de UsoUse como quiser, não é necessário dar créditos, visto que é só uma modificação dos scripts originais.