Preserved forum archive. This topic stores the original first post and locally mirrored RPG Maker Web attachments when available. It is posted by the BMMPlay archive account, not by the original creator.
Original Source
- Original title: Bind Pictures To Map conflicting with Yscale
- Original author: CheerfulGoth
- Original date: September 5, 2017
- Source thread: https://forums.rpgmakerweb.com/threads/bind-pictures-to-map-conflicting-with-yscale.83653/
- Source forum path: Game Development Engines > RPG Maker Javascript Plugins > Javascript/Plugin Support
Summary
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: {
Archived First Post
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:
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.
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.
Downloads / Referenced Files
Log in to download
Log in, then follow the RPG Maker Developers Group to see these download links.
Log in to downloadCreator Claims / Removal
If you are the original creator and want this listing reassigned, edited, or removed, join BMMPlay and contact the moderators with proof that matches the original RPG Maker Web profile, linked GitHub, itch.io page, or another public creator identity.
Replies (0)
No replies yet.
0
replies
1
view
Topic Summary
Loading summary...