じ☆ve冰风 发表于 2026-7-26 21:51:10

PlayerShiftTurn (Turnaround)

PlayerShiftTurn - Version 1.0.1 (2016/07/09)

Creator name: Triacontane

Overview
Player can turnaround

Features
- While holding a certain key , change direction of player's facing from arrow key.
- Parameter for KeyName control (shift or control or tab)
- Player does not have to move to face a direction.

Preview

https://i.imgur.com/7h4YY2j.gif


Note: this does not support touch/ mouse control

Credit and Thanks: Triacontane

Terms of Use- Free for commercial and non-commercial use.

License - MIT License: http://opensource.org/licenses/mit-license.php

You can download js file from the thread attachment or Dropbox link: https://www.dropbox.com/s/7brx858kygswug0/PlayerShiftTurn.js?dl=1

Spoiler: Alternative                Code:       
//=============================================================================
// PlayerShiftTurn.js
// ----------------------------------------------------------------------------
// Copyright (c) 2015 Triacontane
// This software is released under the MIT License.
// http://opensource.org/licenses/mit-license.php
// ----------------------------------------------------------------------------
// Version
// 1.0.1 2016/07/09 Fixed an issue with 8 direction (diagonal) movement plugin
// 1.0.0 2016/01/06 First release
// ----------------------------------------------------------------------------
//    : http://triacontane.blogspot.jp/
// : https://twitter.com/triacontane/
// : https://github.com/triacontane/
//=============================================================================

/*:
* @plugindesc Player can turnaround
* @author Triacontane
*
* @param KeyName
* @desc Holding a certain key, change direction of player's facing from arrow key.
* (shift or control or tab)
* @default shift
*
* @help Player does not have to move to face a direction.
* Holding a key and press arrow key will change direction where the player facing.
*
* Terms of Service:
*It's possible to modify and redistribute without permission from the author.
*And this plugin licensed under MIT License.
*/
(function () {
    'use strict';
    var pluginName = 'PlayerShiftTurn';

    var getParamString = function(paramNames) {
      var value = getParamOther(paramNames);
      return value == null ? '' : value;
    };

    var getParamOther = function(paramNames) {
      if (!Array.isArray(paramNames)) paramNames = ;
      for (var i = 0; i < paramNames.length; i++) {
            var name = PluginManager.parameters(pluginName)];
            if (name) return name;
      }
      return null;
    };

    //=============================================================================
    // Parameter formatting
    //=============================================================================
    var paramButtonName = getParamString(['KeyName', 'ボタン名称']).toLowerCase();

    //=============================================================================
    // Game_Player
    //Holding a specified key, changes the direction without moving the player.
    //=============================================================================
    var _Game_Player_executeMove = Game_Player.prototype.executeMove;
    Game_Player.prototype.executeMove = function(direction) {
      if (Input.isPressed(paramButtonName)) {
            if (direction === Input.dir4) {
                this.setDirection(direction);
            }
      } else {
            _Game_Player_executeMove.apply(this, arguments);
      }
    };
})();




本贴来自国际rpgmaker官方论坛作者:ovate处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/playershiftturn-turnaround.102688/
页: [1]
查看完整版本: PlayerShiftTurn (Turnaround)