本帖最后由 astercanary 于 2024-12-6 15:01 编辑 如题,在同时使用无限图层和像素移动后,在移动,尤其是斜向移动时,事件抖动非常厉害 像素移动插件是dotmove,检查之后事件本身没有抖动,是无限图层添加的远景 ...
var ULDS = ULDS || {}; ULDS.JitterFix = {}; ULDS.JitterFixPlus = 1 / 1000000; // 误差值 ULDS.JitterFix.Parameters = PluginManager.parameters('JitterFix'); ULDS.JitterFix.TileSize = Number(ULDS.JitterFix.Parameters["Tile Size"]) || 48; // 修改地图的显示坐标 Game_Map.prototype.displayX = function() { return Math.floor(this._displayX * ULDS.JitterFix.TileSize) / ULDS.JitterFix.TileSize; };// 消除移动带来的误差,消除小数 Game_Map.prototype.displayY = function() { return Math.floor(this._displayY * ULDS.JitterFix.TileSize) / ULDS.JitterFix.TileSize; }; Game_Map.prototype.adjustX = function(x) { if (this.isLoopHorizontal() && x < (this.displayX() - (this.width() - ULDS.JitterFix.TileSize) / 1000000)) { x -= this.displayX() + this.width()-ULDS.JitterFixPlus; } else { x -= this.displayX(); } return x; // 消除精度误差 }; Game_Map.prototype.adjustY = function(y) { if (this.isLoopVertical() && y < (this.displayY() - (this.height() - ULDS.JitterFix.TileSize) / 1000000)) { y -= this.displayY() + this.height()-ULDS.JitterFixPlus; } else { y -= this.displayY(); } return y; }; // 同步事件的显示坐标 Game_Map.prototype.displayX = function() { return Math.floor(this._displayX * ULDS.JitterFix.TileSize) / ULDS.JitterFix.TileSize; }; Game_Map.prototype.displayY = function() { return Math.floor(this._displayY * ULDS.JitterFix.TileSize) / ULDS.JitterFix.TileSize; }; // 修改 Game_Event 中的事件显示坐标 Game_Event.prototype.screenX = function() { // 修正事件的显示位置,确保与地图完全对齐 return (this._realX +0.5- $gameMap.displayX()) * ULDS.JitterFix.TileSize; }; Game_Event.prototype.screenY = function() { // 同样,修正事件的显示位置,确保与地图完全对齐 return (this._realY +1- $gameMap.displayY()) * ULDS.JitterFix.TileSize; }; // 更新事件的屏幕坐标 Game_Event.prototype.updateScreenPosition = function() { // 直接设置事件的显示坐标,保持与地图位置绑定 this._screenX = this.screenX(); this._screenY = this.screenY(); };
折叠内容标题(非必须)
折叠内容
站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作
GMT+8, 2025-1-11 20:03
Powered by Discuz! X3.1
© 2001-2013 Comsenz Inc.