From 19aec407935ee27e594942d4f1cf54ed14cd17fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=88=E3=83=AA=E3=82=A2=E3=82=B3=E3=83=B3=E3=82=BF?= =?UTF-8?q?=E3=83=B3?= Date: Mon, 17 Sep 2018 22:30:14 +0900 Subject: [PATCH] =?UTF-8?q?1.0.0=202018/09/17=20=E5=88=9D=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FixSimultaneouslyPress.js | 65 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 FixSimultaneouslyPress.js diff --git a/FixSimultaneouslyPress.js b/FixSimultaneouslyPress.js new file mode 100644 index 00000000..cfbfb4b7 --- /dev/null +++ b/FixSimultaneouslyPress.js @@ -0,0 +1,65 @@ +/*============================================================================= + FixSimultaneouslyPress.js +---------------------------------------------------------------------------- + (C)2018 Triacontane + This software is released under the MIT License. + http://opensource.org/licenses/mit-license.php +---------------------------------------------------------------------------- + Version + 1.0.0 2018/09/17 初版 +---------------------------------------------------------------------------- + [Blog] : https://triacontane.blogspot.jp/ + [Twitter]: https://twitter.com/triacontane/ + [GitHub] : https://github.com/triacontane/ +=============================================================================*/ + +/*: + * @plugindesc FixSimultaneouslyPressPlugin + * @author triacontane + * + * @help FixSimultaneouslyPress.js + * + * 同一フレーム内で複数のキーを同時押しした際に + * Input.isTriggeredがいずれか一つのキーしか感知しない仕様を変更します。 + *  + * このプラグインにはプラグインコマンドはありません。 + * + * This plugin is released under the MIT License. + */ +/*:ja + * @plugindesc 同時押し仕様変更プラグイン + * @author トリアコンタン + * + * @help FixSimultaneouslyPress.js + * + * 同一フレーム内で複数のキーを同時押しした際に + * Input.isTriggeredがいずれか一つのキーしか感知しない仕様を変更します。 + *  + * このプラグインにはプラグインコマンドはありません。 + * + * 利用規約: + * 作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等) + * についても制限はありません。 + * このプラグインはもうあなたのものです。 + */ + +(function() { + 'use strict'; + + var _Input_update = Input.update; + Input.update = function() { + this._latestButtons = []; + for (var name in this._currentState) { + if (this._currentState[name] && !this._previousState[name]) { + this._latestButtons.push(name); + } + } + _Input_update.apply(this, arguments); + }; + + var _Input_isTriggered = Input.isTriggered; + Input.isTriggered = function(keyName) { + var result = _Input_isTriggered.apply(this, arguments); + return result || (this._latestButtons.contains(keyName) && this._pressedTime === 0); + }; +})();