Skip to content

Instantly share code, notes, and snippets.

@Watball
Created October 27, 2014 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Watball/3ef79bfbb57ba3dc1576 to your computer and use it in GitHub Desktop.
Save Watball/3ef79bfbb57ba3dc1576 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Tagpro Rotating Balls - NewCompte's server
// @namespace http://www.reddit.com/user/NewCompte
// @description Tagpro Rotating Balls
// @include http://*.koalabeast.com:*
// @license GPL
// @author NewCompte
// @version 0.5
// ==/UserScript==
function myRotatingBallsScript() {
tagpro.ready(function(){
//This is important.
if(tagpro.events.drawPlayer)
return;
tagpro.events.register({
drawPlayer: function(player, context, drawPos, TILESIZE) {
context.save();
context.translate(drawPos.x + (TILESIZE / 2) * (1 / tagpro.zoom), drawPos.y + (TILESIZE / 2) * (1 / tagpro.zoom));
context.rotate(player.angle)
context.translate(-drawPos.x - (TILESIZE / 2) * (1 / tagpro.zoom), -drawPos.y - (TILESIZE / 2) * (1 / tagpro.zoom));
tagpro.tiles.drawWithZoom(context, player.team == 1 ? "redball" : "blueball", drawPos);
if (player.bomb && Math.round(Math.random() * 4) == 1) {
context.fillStyle = "rgba(255, 255, 0, .50)";
context.beginPath();
context.arc(drawPos.x + (TILESIZE / 2) * (1 / tagpro.zoom), drawPos.y + (TILESIZE / 2) * (1 / tagpro.zoom), 20 * (1 / tagpro.zoom), 0, Math.PI*2, true);
context.closePath();
context.fill();
};
if (player.tagpro) {
context.strokeStyle = "#00FF00";
context.fillStyle = "rgba(0, 255, 0, .25)";
context.lineWidth = 3 * (1 / tagpro.zoom);
context.beginPath();
context.arc(drawPos.x + (TILESIZE / 2) * (1 / tagpro.zoom), drawPos.y + (TILESIZE / 2) * (1 / tagpro.zoom), 20 * (1 / tagpro.zoom), 0, Math.PI*2, true);
context.closePath();
if (!player.bomb)
context.fill();
context.stroke();
}
context.restore();
}
});
});
}
var source = "("+ myRotatingBallsScript + ")()";
var script = document.createElement('script');
script.setAttribute("type", "application/javascript");
script.textContent = source;
document.body.appendChild(script);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment