Project1
标题:
窗口大小和战斗站位出现了问题
[打印本页]
作者:
wqd3906
时间:
2022-1-9 14:04
标题:
窗口大小和战斗站位出现了问题
我用自带调大小插件改了窗口大小,后发现左右会出现竖的黑条。进战斗后敌人和自己站的很近,并且下面的状态人名和hp隔了很远。请问有什么办法解决吗?
作者:
cenhangkai
时间:
2022-1-9 16:56
· 你指的是 Community_Basic 这个插件吧。
· 它并没有支持战斗背景自动拉伸、玩家/敌人精灵位置兼容分辨率。
· 下面是我已经添加了这些功能后的 【优化版】。
· 你将下述代码复制粘贴,覆盖掉 Community_Basic 里面的所有代码即可解决。
· 如果不会覆盖,你直接 新建一个插件,把下面的代码复制粘贴进去,改名 Community_Basic 也可。
————————————————————————————————————————————————————
/*:
* @plugindesc Plugin used to set basic parameters.
* @author RM CoreScript team
*
* @help This plugin does not provide plugin commands.
*
* @param cacheLimit
* @desc For setting the upper limit of image memory cache. (MPix)
* @default 10
*
* @param screenWidth
* @desc For setting the screen width.
* @default 816
*
* @param screenHeight
* @desc For setting the screen height.
* @default 624
*
* @param changeWindowWidthTo
* @desc If set, change window width to this value
*
* @param changeWindowHeightTo
* @desc If set, change window height to this value
*
* @param renderingMode
* @desc Rendering mode (canvas/webgl/auto)
* @default auto
*
* @param alwaysDash
* @desc To set initial value as to whether the player always dashes. (on/off)
* @default off
*/
/*:ja
* @plugindesc 基本的なパラメーターを設定するプラグインです。
* @author RM CoreScript team
*
* @help このプラグインにはプラグインコマンドはありません。
*
* @param cacheLimit
* @desc 画像のメモリへのキャッシュの上限値 (MPix)
* @default 10
*
* @param screenWidth
* @desc 画面サイズの幅
* @default 816
*
* @param screenHeight
* @desc 画面サイズの高さ
* @default 624
*
* @param changeWindowWidthTo
* @desc 値が設定された場合、ウインドウの幅を指定した値に変更
*
* @param changeWindowHeightTo
* @desc 値が設定された場合、ウインドウの高さを指定した値に変更
*
* @param renderingMode
* @desc レンダリングモード (canvas/webgl/auto)
* @default auto
*
* @param alwaysDash
* @desc プレイヤーが常時ダッシュするかどうかの初期値 (on/off)
* @default off
*/
(function() {
function toNumber(str, def) {
return isNaN(str) ? def : +(str || def);
}
var parameters = PluginManager.parameters('Community_Basic');
var cacheLimit = toNumber(parameters['cacheLimit'], 10);
var screenWidth = toNumber(parameters['screenWidth'], 816);
var screenHeight = toNumber(parameters['screenHeight'], 624);
var renderingMode = parameters['renderingMode'].toLowerCase();
var alwaysDash = parameters['alwaysDash'].toLowerCase() === 'on';
var windowWidthTo = toNumber(parameters['changeWindowWidthTo'], 0);
var windowHeightTo = toNumber(parameters['changeWindowHeightTo'], 0);
var windowWidth;
var windowHeight;
if(windowWidthTo){
windowWidth = windowWidthTo;
}else if(screenWidth !== SceneManager._screenWidth){
windowWidth = screenWidth;
}
if(windowHeightTo){
windowHeight = windowHeightTo;
}else if(screenHeight !== SceneManager._screenHeight){
windowHeight = screenHeight;
}
ImageCache.limit = cacheLimit * 1000 * 1000;
SceneManager._screenWidth = screenWidth;
SceneManager._screenHeight = screenHeight;
SceneManager._boxWidth = screenWidth;
SceneManager._boxHeight = screenHeight;
SceneManager.preferableRendererType = function() {
if (Utils.isOptionValid('canvas')) {
return 'canvas';
} else if (Utils.isOptionValid('webgl')) {
return 'webgl';
} else if (renderingMode === 'canvas') {
return 'canvas';
} else if (renderingMode === 'webgl') {
return 'webgl';
} else {
return 'auto';
}
};
var _ConfigManager_applyData = ConfigManager.applyData;
ConfigManager.applyData = function(config) {
_ConfigManager_applyData.apply(this, arguments);
if (config['alwaysDash'] === undefined) {
this.alwaysDash = alwaysDash;
}
};
var _SceneManager_initNwjs = SceneManager.initNwjs;
SceneManager.initNwjs = function() {
_SceneManager_initNwjs.apply(this, arguments);
if (Utils.isNwjs() && windowWidth && windowHeight) {
var dw = windowWidth - window.innerWidth;
var dh = windowHeight - window.innerHeight;
window.moveBy(-dw / 2, -dh / 2);
window.resizeBy(dw, dh);
}
};
var _sprite_Actor_setActorHome = Sprite_Actor.prototype.setActorHome;
Sprite_Actor.prototype.setActorHome = function(index) {
_sprite_Actor_setActorHome.call(this, index);
this._homeX += Graphics.boxWidth - 816;
this._homeY += Graphics.boxHeight - 624;
};
Sprite_Actor.prototype.retreat = function() {
this.startMove(1200, 0, 120);
};
var _sprite_Enemy_setBattler = Sprite_Enemy.prototype.setBattler;
Sprite_Enemy.prototype.setBattler = function(battler) {
_sprite_Enemy_setBattler.call(this, battler);
if (!this._enemy._alteredScreenY) {
this._homeY += Graphics.boxHeight - 624;
this._enemy._screenY = this._homeY;
this._enemy._alteredScreenY = true;
}
if ($gameSystem.isSideView()) return;
if (!this._enemy._alteredScreenX) {
this._homeX += (Graphics.boxWidth - 816) / 2;
this._enemy._screenX = this._homeX;
this._enemy._alteredScreenX = true;
}
};
function Sprite_Battleback() {
this.initialize.apply(this, arguments);
}
Sprite_Battleback.prototype = Object.create(Sprite.prototype);
Sprite_Battleback.prototype.constructor = Sprite_Battleback;
Sprite_Battleback.prototype.initialize = function(bitmapName, type) {
Sprite.prototype.initialize.call(this);
this._bitmapName = bitmapName;
this._battlebackType = type;
this.createBitmap();
};
Sprite_Battleback.prototype.createBitmap = function() {
if (this._bitmapName === '') {
this.bitmap = new Bitmap(Graphics.boxWidth, Graphics.boxHeight);
} else {
if (this._battlebackType === 1) {
this.bitmap = ImageManager.loadBattleback1(this._bitmapName);
} else {
this.bitmap = ImageManager.loadBattleback2(this._bitmapName);
}
this.scaleSprite();
}
};
Sprite_Battleback.prototype.scaleSprite = function() {
if (this.bitmap.width <= 0) return setTimeout(this.scaleSprite.bind(this), 5);
var width = Graphics.boxWidth;
var height = Graphics.boxHeight;
if (this.bitmap.width < width) {
this.scale.x = width / this.bitmap.width;
}
if (this.bitmap.height < height) {
this.scale.y = height / this.bitmap.height;
}
this.anchor.x = 0.5;
this.x = Graphics.boxWidth / 2;
if ($gameSystem.isSideView()) {
this.anchor.y = 1;
this.y = Graphics.boxHeight;
} else {
this.anchor.y = 0.5;
this.y = Graphics.boxHeight / 2;
}
};
Spriteset_Battle.prototype.createBattleback = function() {
this._back1Sprite = new Sprite_Battleback(this.battleback1Name(), 1);
this._back2Sprite = new Sprite_Battleback(this.battleback2Name(), 2);
this._battleField.addChild(this._back1Sprite);
this._battleField.addChild(this._back2Sprite);
};
Spriteset_Battle.prototype.updateBattleback = function() {
};
})();
复制代码
作者:
wqd3906
时间:
2022-1-9 17:02
cenhangkai 发表于 2022-1-9 16:56
· 你指的是 Community_Basic 这个插件吧。
· 它并没有支持战斗背景自动拉伸、玩家/敌人精灵位置兼容分辨 ...
万分感谢~
作者:
a2313211
时间:
2022-1-23 22:34
6666666666
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1