Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==========================================================================
- // Plugin: Sprite Button Anchor Fix
- // Author: Zalerinian
- // Version: 1.0.0
- // ==========================================================================
- var Imported = Imported || {};
- Imported["Spr_ButtonAnchorFix"] = "1.0.0";
- /*:
- * @plugindesc A plugin to fix click region issues with button sprites when their anchor is not set to 0, 0.
- * @author Zalerinian
- *
- * @help
- * This plugin is plug 'n play, with no configuration. It fixes an issue where
- * sprites of the Sprite_Button class would not have their clickable regions
- * moved if their 'anchor' property was not set to (0, 0)
- */
- Sprite_Button.prototype.isButtonTouched = function() {
- var x = this.canvasToLocalX(TouchInput.x) + (this.anchor.x * this.width);
- var y = this.canvasToLocalY(TouchInput.y) + (this.anchor.y * this.height);
- return x >= 0 && y >= 0 && x < this.width && y < this.height
- };
Advertisement
Add Comment
Please, Sign In to add comment