Fighting against a maddening small bug. I use bind pictures to map together with YScale, and every time the camera moves in a large map, the binded pictures slightly wobble. Have a bad gif, look at the tree behind the character: {
Fighting against a maddening small bug.
I use
bind pictures to map together with
YScale, and every time the camera moves in a large map, the binded pictures slightly
wobble.
Have a bad gif, look at the tree behind the character:
I believe I know
why this is happening, but I can't seem fix it! It's because of this bit in
bind pics to map:
Code:
//=============================================================================
// Game_Picture
//=============================================================================
/**
* Fix to displayX's returned decimal value to hinder JS rounding errors
*/
Game_Map.prototype.displayX = function() {
return Math.ceil10(this._displayX, -8);
};
/**
* Fix to displayY's returned decimal value to hinder JS rounding errors
*/
Game_Map.prototype.displayY = function() {
return Math.ceil10(this._displayY, -8);
};
//=============================================================================
// Math additions
//=============================================================================
/**
* Decimal adjustment of a number.
*
* @param {String} type The type of adjustment.
* @param {Number} value The number.
* @param {Integer} exp The exponent (the 10 logarithm of the adjustment base).
* @returns {Number} The adjusted value.
*/
function decimalAdjust(type, value, exp) {
// If the exp is undefined or zero...
if (typeof exp === 'undefined' || +exp === 0) {
return Math[type](value);
}
value = +value;
exp = +exp;
// If the value is not a number or the exp is not an integer...
if (isNaN(value) || !(typeof exp === 'number' && exp % 1 === 0)) {
return NaN;
}
// Shift
value = value.toString().split('e');
value = Math[type](+(value[0] + 'e' + (value[1] ? (+value[1] - exp) : -exp)));
// Shift back
value = value.toString().split('e');
return +(value[0] + 'e' + (value[1] ? (+value[1] + exp) : exp));
}
// Decimal ceil
if (!Math.ceil10) {
Math.ceil10 = function(value, exp) {
return decimalAdjust('ceil', value, exp);
};
}
Since Yscale aliases Game_Map, the two functions get ignored - and thus the pictures get slightly missplacen every few steps due to rounding errors.
I'm pretty sure this is the issue, but Ihaven't managed to fix it on my own ;__; I tried pasting this code into Yscale and calling the function from there, but with no avail.
Will send cat pictures for help.