Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Halloween Ball and Powerup Test (New Flags)
- // @namespace http://*.koalabeast.com:*
- // @version 1.4.1
- // @description Shows ball spin, empty power-up tiles, and pixel perfect tagpro/rolling bomb. Also new textures.
- // @match http://koalabeast.com
- // @copyright 2014+, Ly and a little bit of Cumflakes
- // @include http://*.koalabeast.com*
- // @include http://*.jukejuice.com*
- // @include http://*.newcompte.fr*
- // @include http://justletme.be*
- // ==/UserScript==
- tagpro.ready(function(){
- //This is important.
- if(tagpro.events.drawPlayer)
- return;
- //Textures.
- var image = new Image();
- image.src = "http://i.imgur.com/wxVw83c.png";
- //Empty power-up tile.
- tagpro.tiles[6]["x"] = 12;
- tagpro.tiles[6]["y"] = 8;
- //Custom Halloween Flags
- tagpro.tiles['redflag'].x = 14;
- tagpro.tiles['redflag'].y = 7;
- tagpro.tiles['blueflag'].x = 15;
- tagpro.tiles['blueflag'].y = 7;
- tagpro.tiles['yellowflag'].x = 13;
- tagpro.tiles['yellowflag'].y = 7;
- setTimeout(function() {
- var offset={x:-10, //-13 for centered on ball x
- y:0}; //-32 for centered on ball y
- var old = tagpro.tiles.draw; //grab old function so we can use it later
- tagpro.tiles.draw = function (e,t,n,r,i,s,o) {
- if(t=='redflag' || t=='blueflag' || t=='yellowflag') //only care about when player is holding a flag
- {
- //taken from game code
- o=o||!1;
- var a=tagpro.tiles[t];
- r=r||40;
- i=i||40;
- var f=a.spread||0,
- l=(a.size||r)*(o?1/tagpro.zoom:1),
- c=(a.size||i)*(o?1/tagpro.zoom:1);
- if(!tagpro.tiles.tileCanvases[t])
- {
- var r=document.createElement("canvas");
- r.width=a.size||40,
- r.height=a.size||40;
- var i=r.getContext("2d"),
- o=a.x*40-f,
- u=a.y*40-f,
- h=(a.size||40)+f*2;
- i.drawImage(tagpro.tiles.image,o,u,h,h,0,0,h,h),
- tagpro.tiles.tileCanvases[t]=r
- }
- //draw it with our offsets in place
- e.drawImage(tagpro.tiles.tileCanvases[t],n.x-f+offset.x/tagpro.zoom,n.y-f-offset.y/tagpro.zoom,l+f*2,c+f*2),
- e.globalAlpha=1;
- }
- else //for everything else do whatever it normally does
- {
- old(e,t,n,r,i,s,o);
- }
- }
- }, 500);
- tagpro.events.register({
- drawPlayer: function(player, context, drawPos, TILESIZE) {
- 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.tagpro)
- context.drawImage(image, 2 * 40, 0, 40, 40 , drawPos.x, drawPos.y, 40 / tagpro.zoom, 40 / tagpro.zoom);
- if (player.bomb && Math.round(Math.random() * 4) == 1) {
- context.globalAlpha = 0.7;
- context.drawImage(image, 3 * 40, 0, 40, 40 , drawPos.x, drawPos.y, 40 / tagpro.zoom, 40 / tagpro.zoom);
- context.globalAlpha = 1;
- }
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment