Arbybear

Smooth Movement TagPro

Jul 16th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. // ==UserScript==
  2. // @name TagPro Smooth Movement
  3. // @version 0.1
  4. // @include http://*.koalabeast.com:*
  5. // @include http://*.jukejuice.com:*
  6. // @include http://*.newcompte.fr:*
  7. // @noframes
  8. // @grant none
  9. // @noframes
  10. // ==/UserScript==
  11.  
  12. (function init(initTime) {
  13. if (typeof tagpro === "undefined" || !tagpro.playerId) {
  14. if (Date.now() - initTime > 10000) return;
  15. return setTimeout(init, 100, initTime);
  16. }
  17. setTimeout(startFunction, 3000);
  18. })(Date.now());
  19.  
  20. function startFunction() {
  21. var tr = tagpro.renderer;
  22. var upsp = tr.updatePlayerSpritePosition;
  23.  
  24. tr.updatePlayerSpritePosition = function(player) {
  25. upsp.apply(this, arguments);
  26. player.sprite.x = player.x;
  27. player.sprite.y = player.y;
  28. };
  29.  
  30. tr.centerContainerToPoint = function(x, y) {
  31. var r = tr.options.disableViewportScaling ? 1 : (this.vpHeight / tr.canvas_height).toFixed(2);
  32. if (tagpro.viewport.followPlayer) {
  33. var self = tagpro.players[tagpro.playerId];
  34. x = self.x + 20;
  35. y = self.y + 20;
  36. }
  37. if (x == -980 && y == -980) {
  38. return;
  39. }
  40. tr.gameContainer.x = this.vpWidth / 2 - x / tagpro.zoom * r;
  41. tr.gameContainer.y = this.vpHeight / 2 - y / tagpro.zoom * r;
  42. };
  43.  
  44. tr.updateCameraPosition = function() {
  45. tr.centerContainerToPoint();
  46. };
  47. }
Advertisement
Add Comment
Please, Sign In to add comment