Project1

标题: 【鸡肋Mini插件】弹性镜头移动 [打印本页]

作者: 刺夜之枪    时间: 2016-8-31 13:27
标题: 【鸡肋Mini插件】弹性镜头移动
JAVASCRIPT 代码复制下载
  1. //=============================================================================
  2. // Mount Blade Battle System Engine Plugins - Elastically Scroll
  3. // MBBS_ElasticallyScroll.js
  4. //=============================================================================
  5. /*:
  6.  * @plugindesc v1.0 MBBS Plugins:
  7.     群战系统MV插件系列之 - 弹性镜头移动 【XP移植】
  8.     MBBS_ElasticallyScroll
  9.  * @author Chivalry Studio Plugins / Ivan
  10. */
  11. var Imported = Imported || {};
  12. Imported.MBBS_ElasticallyScroll = true;
  13.  
  14. var MBBS_MV = MBBS_MV || {};
  15. MBBS_MV.ElasticallyScroll = MBBS_MV.MBBS_ElasticallyScroll || {};
  16.  
  17. //=============================================================================
  18. // Game_Player
  19. //=============================================================================
  20. Game_Player.prototype.updateScroll = function(lastScrolledX, lastScrolledY) {
  21.     var x1 = lastScrolledX;
  22.     var y1 = lastScrolledY;
  23.     var x2 = this.scrolledX();
  24.     var y2 = this.scrolledY();
  25.  
  26.     var halfTileWidth   = $gameMap.tileWidth()/2.0;
  27.     var halfTileHeight   = $gameMap.tileHeight()/2.0;
  28.  
  29.     var yGrid = this.centerY()*2;
  30.     var xGrid = this.centerX()*2;
  31.  
  32.     if (y2 > this.centerY()){
  33.       $gameMap.scrollDown(this._realY > $gameMap.height() - this.centerY() ?
  34.         ($gameMap.height() - yGrid - $gameMap.displayY())/halfTileHeight :
  35.         ((y2 - yGrid + this.centerY())/halfTileHeight))
  36.     }
  37.     if (x2 < this.centerX() ){
  38.       $gameMap.scrollLeft(this._realX < this.centerX() ? $gameMap.displayX()/halfTileWidth :
  39.         (($gameMap.displayX() + this.centerX() - this._realX)/halfTileWidth))
  40.     }
  41.     if (x2 > xGrid - this.centerX() ){
  42.       $gameMap.scrollRight(this._realX > $gameMap.width - this.centerX()  ?
  43.         (($gameMap.width - xGrid) - $gameMap.displayX())/halfTileWidth :
  44.         (x2 - xGrid + this.centerX() )/halfTileWidth)
  45.     }
  46.     if (y2 < this.centerY()){
  47.         $gameMap.scrollUp(this._realY < this.centerY() ?  $gameMap.displayY()/halfTileHeight :
  48.       (($gameMap.displayY()+this.centerY()-this._realY)/halfTileHeight))
  49.     }
  50.  
  51. };
  52.  
  53.  
  54. if (Imported.MBBS_MV) {
  55.     Game_EFS_Hero.prototype.updateScroll = function(lastScrolledX, lastScrolledY) {
  56.       var x1 = lastScrolledX;
  57.       var y1 = lastScrolledY;
  58.       var x2 = this.scrolledX();
  59.       var y2 = this.scrolledY();
  60.  
  61.       var halfTileWidth   = $gameMap.tileWidth()/2.0;
  62.       var halfTileHeight   = $gameMap.tileHeight()/2.0;
  63.  
  64.       var yGrid = this.centerY()*2;
  65.       var xGrid = this.centerX()*2;
  66.  
  67.       if (y2 > this.centerY()){
  68.         $gameMap.scrollDown(this._realY > $gameMap.height() - this.centerY() ?
  69.           ($gameMap.height() - yGrid - $gameMap.displayY())/halfTileHeight :
  70.           ((y2 - yGrid + this.centerY())/halfTileHeight))
  71.       }
  72.       if (x2 < this.centerX() ){
  73.         $gameMap.scrollLeft(this._realX < this.centerX() ? $gameMap.displayX()/halfTileWidth :
  74.           (($gameMap.displayX() + this.centerX() - this._realX)/halfTileWidth))
  75.       }
  76.       if (x2 > xGrid - this.centerX() ){
  77.         $gameMap.scrollRight(this._realX > $gameMap.width - this.centerX()  ?
  78.           (($gameMap.width - xGrid) - $gameMap.displayX())/halfTileWidth :
  79.           (x2 - xGrid + this.centerX() )/halfTileWidth)
  80.       }
  81.       if (y2 < this.centerY()){
  82.           $gameMap.scrollUp(this._realY < this.centerY() ?  $gameMap.displayY()/halfTileHeight :
  83.         (($gameMap.displayY()+this.centerY()-this._realY)/halfTileHeight))
  84.       }
  85.  
  86.   };
  87. }
  88.  
  89.  
  90. //=============================================================================
  91. // End of File
  92. //=============================================================================




这个插件本来是群战核心系统的一部分,我今天顺手给他拆了出来,=。=

具体功能很鸡肋,就是让主角移动的时候镜头有弹性地滚动。试试看就知道了

可以配合群战核心系统使用(然而并没有发布)



作者: 光头爷爷    时间: 2016-9-1 23:01
谢谢,已经收藏
作者: 汪汪    时间: 2016-9-2 18:00
坐等群战
作者: anlei    时间: 2016-9-27 23:33
坐等群战++1
作者: Vortur    时间: 2016-9-28 06:51
没糖了,手+45!

  群战MV要表加点剧情呢?



  
作者: huangrhone    时间: 2018-11-13 00:50
奇怪.使用插件后    当角色行走时   地图内的一些NPC会有抖动还为啥....等到角色停止不动      镜头不动了才会慢慢恢复




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1