Skip to content

Instantly share code, notes, and snippets.

@mitzimoto
Created September 14, 2014 03:44
Show Gist options
  • Save mitzimoto/df4d97ee66867c9c1932 to your computer and use it in GitHub Desktop.
Save mitzimoto/df4d97ee66867c9c1932 to your computer and use it in GitHub Desktop.
TagPro "Modern" texturepack with spinning balls.
// ==UserScript==
// @name TagPro Pro
// @namespace http://www.reddit.com/user/CumFlakes
// @description Rotating Balls, pixel perfect power-ups.
// @include http://*.koalabeast.com*
// @include http://*.jukejuice.com*
// @include http://*.newcompte.fr*
// @include http://justletme.be*
// @license GPL
// @author NewCompte, Ly, Cumflakes.
// @version 1
// ==/UserScript==
function myRotatingBallsScript() {
tagpro.ready(function(){
if(tagpro.events.drawPlayer)
return;
var image = new Image();
image.src = "http://i.imgur.com/K9SbmSz.png";
document.getElementById("tiles").src = "https://i.imgur.com/stGySx9.png";
document.getElementById("splats").src = "https://i.imgur.com/gXpvWEE.png";
document.getElementById("speedpad").src = "https://i.imgur.com/aCHBxVO.png";
document.getElementById("speedpadred").src = "https://i.imgur.com/xKupyqI.png";
document.getElementById("speedpadblue").src = "https://i.imgur.com/4dybmaE.png";
document.getElementById("portal").src = "https://i.imgur.com/KAo7jkl.png";
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);
context.restore();
//if (player.team == 1)
// context.drawImage(image, 0 * 40, 0, 40, 40, drawPos.x, drawPos.y, 40 / tagpro.zoom, 40 / tagpro.zoom);
//if (player.team == 2)
// context.drawImage(image, 1 * 40, 0, 40, 40, drawPos.x, drawPos.y, 40 / tagpro.zoom, 40 / tagpro.zoom);
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), 19 * (1 / tagpro.zoom), 0, Math.PI*2, true);
context.closePath();
context.fill();
};
if (player.tagpro) {
context.strokeStyle = "rgba(0, 255, 0, .80)";
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), 18 * (1 / tagpro.zoom), 0, Math.PI*2, true);
context.closePath();
if (!player.bomb)
context.fill();
context.stroke();
}
}
});
});
}
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