I want to write a small plugin to check if the mouse is hovering over a picture. That's my code so far:
In the debugger, when I inspect the Game_Picture object, I can see that _hovered is set correctly. However, when I access it, regardless whether
I really don't get it.
Code:
const alias_SpritePicture_update = Sprite_Picture.prototype.update;
Sprite_Picture.prototype.update = function() {
alias_SpritePicture_update.call(this);
const picture = this.picture();
if (picture) {
picture._hovered = this.isBeingTouched();
}
}
Game_Picture.prototype.isBeingTouched = function() {
return !!this._hovered;
}
In the debugger, when I inspect the Game_Picture object, I can see that _hovered is set correctly. However, when I access it, regardless whether
$gameScreen.picture(i)._hovered or ...isBeingTouched(), it's always false or undefined.I really don't get it.