Skip to content

Instantly share code, notes, and snippets.

Created July 9, 2014 07:24
Show Gist options
  • Save anonymous/e5d3cd3a9a8a5fc5644f to your computer and use it in GitHub Desktop.
Save anonymous/e5d3cd3a9a8a5fc5644f to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name TagPro Minimal Spin
// @description Rotating Balls, pixel perfect tagpro.
// @include http://*.koalabeast.com:*
// @include http://*.jukejuice.com:*
// @include http://*.newcompte.fr:*
// @include http://justletme.be:*
// @license GPL
// @author NewCompte, Cumflakes.
// @version 1
// ==/UserScript==
function myMinimalSpinScript() {
tagpro.ready(function(){
if(tagpro.events.drawPlayer)
return;
var image = new Image(); image.src = "http://i.imgur.com/KtwiVqW.png";
tagpro.events.register({
drawPlayer: function(player, context, drawPos, TILESIZE) {
tagpro.tiles.drawWithZoom(context, player.team == 1 ? "redball" : "blueball", drawPos);
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));
if (player.team == 1)
context.drawImage(image, 0 * 40, 0, 40, 40, drawPos.x, drawPos.y, 40 / tagpro.zoom, 40 / tagpro.zoom);
else
context.drawImage(image, 1 * 40, 0, 40, 40, drawPos.x, drawPos.y, 40 / tagpro.zoom, 40 / tagpro.zoom);
if (player.tagpro)
context.drawImage(image, 2 * 40, 0, 40, 40 , drawPos.x, drawPos.y, 40 / tagpro.zoom, 40 / tagpro.zoom);
else
context.drawImage(image, 4 * 40, 0, 40, 40 , drawPos.x, drawPos.y, 40 / tagpro.zoom, 40 / tagpro.zoom);
context.restore();
if (player.bomb && Math.round(Math.random() * 4) == 1) {
context.globalAlpha = .7;
context.drawImage(image, 3 * 40, 0, 40, 40 , drawPos.x, drawPos.y, 40 / tagpro.zoom, 40 / tagpro.zoom);
context.globalAlpha = 1;
}
}
});
});
}
var source = "("+ myMinimalSpinScript + ")()";
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