In MV/Z, the picture sprites are ultimately children of the spriteset (which shakes), so I think you'd want something to offset the position of the "non-shake" pictures back to where they would be without shake.
Something like this might work (untested):
Spoiler: plugin code
JavaScript:
/*:
* @target MZ MV
* @plugindesc Make certain pictures not shake with the screen.
* @author Caethyril
* @url https://forums.rpgmakerweb.com/threads/171740/
* @help Free to use and/or modify for any project, no credit required.
*/
;void (function() {
'use strict';
/**
* Used in {@linkcode isNonShakePic}.
* Pictures with a matching filename will shake in antiphase.
*/
const NAME_RX = /!$/; // "ends with !"
/**
* @param {Game_Picture} pic reference picture.
* @returns {boolean} `true` iff `pic` is a "non-shake" picture.
*/
const isNonShakePic = function(pic) {
return pic && NAME_RX.test(pic.name());
};
/**
* @param {Game_Picture} pic reference picture
* @returns {number} additive X-offset for picture position.
*/
const xOffset = function(pic) {
return isNonShakePic(pic) ? -Math.round($gameScreen.shake()) : 0;
};
// Patch - cancel out X-offset due to spriteset shake.
const alias = Sprite_Picture.prototype.updatePosition;
Sprite_Picture.prototype.updatePosition = function() {
alias.apply(this, arguments);
this.x += xOffset(this.picture());
};
})();
In theory, this decides which pictures are "non-shake" based on the picture's filename, e.g.
hud!.png (ends with
!) will be a "non-shake" picture.
It works! Thank you =)
As an additional note: as
almost always, this is not compatible with Visustella_core, since the latter modifies the "screen shake" function, leaving it as "random" by default. However, in the same plugin, you can select "original" (the one from RPG Maker MZ) for the default screen shake, which will allow the plugin's "no screen shake" effect to work.
Now, just out of curiosity, do you think there’s a “simple” way to make it compatible with Visustella_core’s screen shake? I like that it’s random rather than just moving from left to right.
If not, I’ll have to decide whether to give up on Visustella's shake effect to get the effect I want, or leave out the plugin you made. Either way, you’ve helped me with what I was looking for, since now I have an option! Thanks a million! =)