Advertisement
DaxSoft

[MV]Jump

Oct 17th, 2015
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // Jump
  3. // By Kvothe
  4. // Jump.js
  5. // Version: 1.0
  6. // Free for commercial and non commercial use.
  7. //=============================================================================
  8. var Imported = Imported || {};
  9. //=============================================================================
  10. // Variáveis.
  11. //=============================================================================
  12. const KeyJumpFunction = 'shift'; // Shift Key.
  13. var _aliasOldUpdateGamePlayer = Game_Player.prototype.update; // Método alias.
  14. //=============================================================================
  15. // Game_Player:update
  16. //=============================================================================
  17. Game_Player.prototype.update = function() {
  18.   _aliasOldUpdateGamePlayer.call(this); // Velho método.
  19.   // Condição de tecla, teclada.
  20.   if (  Input.isTriggered(KeyJumpFunction)  ) {
  21.     this.jump_by_input.call;
  22.   }
  23.  
  24. }
  25. //=============================================================================
  26. // Game_Player:jump_by_input
  27. //=============================================================================
  28. Game_Player.prototype.jump_by_input = function() {
  29.   // Verificar se é possível.
  30.   if ( Game_Player.prototype.isPassable.call(this.x, this.y, this.direction) ) {
  31.     switch (this.direction) { // Checar as direções.
  32.       case 2:
  33.         this.jump(0, 1);
  34.         break;
  35.       case 4:
  36.         this.jump(-1, 0);
  37.         break;
  38.       case 6:
  39.         this.jump(1, 0);
  40.         break;
  41.       case 8:
  42.         this.jump(0, -1);
  43.         break;
  44.       default:
  45.         break;
  46.     }
  47.   }
  48. }
  49. //=============================================================================
  50. // PluginManager:register
  51. //=============================================================================
  52. PluginManager.register("Jump", "1.0.0.0", "Adiciona a possibilidade do jogador saltar.", {
  53.   email:  "dax-soft@live.com",
  54.   name:   "Kvothe",
  55.   website:  "www.dax-soft.weebly.com"
  56. }, "15-10-2015")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement