Created
June 4, 2015 03:10
-
-
Save JRobH/e4e4e798d6801a7f7a29 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name TagPro Smooth Movement | |
| // @version 0.1 | |
| // @include http://*.koalabeast.com:* | |
| // @include http://*.jukejuice.com:* | |
| // @include http://*.newcompte.fr:* | |
| // @grant none | |
| // ==/UserScript== | |
| (function init(initTime) { | |
| if (typeof tagpro === "undefined" || !tagpro.playerId) { | |
| if (Date.now() - initTime > 10000) return; | |
| return setTimeout(init, 100, initTime); | |
| } | |
| setTimeout(startFunction, 3000); | |
| })(Date.now()); | |
| function startFunction() { | |
| var tr = tagpro.renderer; | |
| var upsp = tr.updatePlayerSpritePosition; | |
| tr.updatePlayerSpritePosition = function(player) { | |
| upsp.apply(this, arguments); | |
| player.sprite.x = player.x; | |
| player.sprite.y = player.y; | |
| }; | |
| tr.centerContainerToPoint = function(x, y) { | |
| var r = tr.options.disableViewportScaling ? 1 : (this.vpHeight / tr.canvas_height).toFixed(2); | |
| if (tagpro.viewport.followPlayer) { | |
| var self = tagpro.players[tagpro.playerId]; | |
| x = self.x + 20; | |
| y = self.y + 20; | |
| } | |
| if (x == -980 && y == -980) { | |
| return; | |
| } | |
| tr.gameContainer.x = this.vpWidth / 2 - x / tagpro.zoom * r; | |
| tr.gameContainer.y = this.vpHeight / 2 - y / tagpro.zoom * r; | |
| }; | |
| tr.updateCameraPosition = function() { | |
| tr.centerContainerToPoint(); | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment