Guest User

MapScroll

a guest
Nov 3rd, 2015
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // MapScroll.js
  3. //=============================================================================
  4.  
  5. /*:
  6.  * @plugindesc Scrolls the map when you get to the edge.
  7.  * @author Jeremy Cannady
  8.  *
  9.  *
  10.  * @help Scrolls the map when you get to the edge, normal maps are 12 by 16
  11.  *      If there are any problems let me know.
  12.  *
  13.  *
  14.  *
  15.  *
  16. */
  17.  
  18. //Completely superseding the updateScroll function.
  19. Game_Player.prototype.updateScroll = function(lastScrolledX, lastScrolledY) {
  20.     var x1 = lastScrolledX;
  21.     var y1 = lastScrolledY;
  22.     var x2 = this.scrolledX();
  23.     var y2 = this.scrolledY();
  24.     //Checks to see if we move beyond the screen if we do then it scrolls it for us.
  25.     //startScroll(direction,distance,speed)
  26.     if (y2 > 12.5) {
  27.         $gameMap.startScroll(2,13,6);
  28.     }
  29.     if (x2 > 16.5) {
  30.         $gameMap.startScroll(6,17,6);
  31.     }
  32.     if (x2 < -0.5) {
  33.         $gameMap.startScroll(4,17,6);
  34.     }
  35.     if (y2 < -0.5) {
  36.         $gameMap.startScroll(8,13,6);
  37.  
  38.     };
  39. };
  40.  
  41. //Completely superseding the canMove function.
  42. Game_Player.prototype.canMove = function() {
  43.     if ($gameMap.isEventRunning() || $gameMessage.isBusy()) {
  44.         return false;
  45.     }
  46.     if (this.isMoveRouteForcing() || this.areFollowersGathering()) {
  47.         return false;
  48.     }
  49.     if (this._vehicleGettingOn || this._vehicleGettingOff) {
  50.         return false;
  51.     }
  52.     if (this.isInVehicle() && !this.vehicle().canMove()) {
  53.         return false;
  54.     }
  55.     //Check to see if we are moving the map, if we are then don't let us move yet.
  56.     if ($gameMap.isScrolling()){
  57.         return false;
  58.     }
  59.     return true;
  60. };
Advertisement
Add Comment
Please, Sign In to add comment