UserNameWTF

Halloween Ball and Powerup Test (New Flags)

Oct 25th, 2014
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.42 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Halloween Ball and Powerup Test (New Flags)
  3. // @namespace http://*.koalabeast.com:*
  4. // @version 1.4.1
  5. // @description Shows ball spin, empty power-up tiles, and pixel perfect tagpro/rolling bomb. Also new textures.
  6. // @match http://koalabeast.com
  7. // @copyright 2014+, Ly and a little bit of Cumflakes
  8. // @include http://*.koalabeast.com*
  9. // @include http://*.jukejuice.com*
  10. // @include http://*.newcompte.fr*
  11. // @include http://justletme.be*
  12. // ==/UserScript==
  13.  
  14. tagpro.ready(function(){
  15. //This is important.
  16. if(tagpro.events.drawPlayer)
  17. return;
  18. //Textures.
  19. var image = new Image();
  20. image.src = "http://i.imgur.com/wxVw83c.png";
  21.  
  22. //Empty power-up tile.
  23. tagpro.tiles[6]["x"] = 12;
  24. tagpro.tiles[6]["y"] = 8;
  25.  
  26. //Custom Halloween Flags
  27. tagpro.tiles['redflag'].x = 14;
  28. tagpro.tiles['redflag'].y = 7;
  29. tagpro.tiles['blueflag'].x = 15;
  30. tagpro.tiles['blueflag'].y = 7;
  31. tagpro.tiles['yellowflag'].x = 13;
  32. tagpro.tiles['yellowflag'].y = 7;
  33.  
  34. setTimeout(function() {
  35.  
  36. var offset={x:-10, //-13 for centered on ball x
  37. y:0}; //-32 for centered on ball y
  38.  
  39.  
  40. var old = tagpro.tiles.draw; //grab old function so we can use it later
  41. tagpro.tiles.draw = function (e,t,n,r,i,s,o) {
  42. if(t=='redflag' || t=='blueflag' || t=='yellowflag') //only care about when player is holding a flag
  43. {
  44. //taken from game code
  45. o=o||!1;
  46. var a=tagpro.tiles[t];
  47. r=r||40;
  48. i=i||40;
  49. var f=a.spread||0,
  50. l=(a.size||r)*(o?1/tagpro.zoom:1),
  51. c=(a.size||i)*(o?1/tagpro.zoom:1);
  52. if(!tagpro.tiles.tileCanvases[t])
  53. {
  54. var r=document.createElement("canvas");
  55. r.width=a.size||40,
  56. r.height=a.size||40;
  57. var i=r.getContext("2d"),
  58. o=a.x*40-f,
  59. u=a.y*40-f,
  60. h=(a.size||40)+f*2;
  61. i.drawImage(tagpro.tiles.image,o,u,h,h,0,0,h,h),
  62. tagpro.tiles.tileCanvases[t]=r
  63. }
  64. //draw it with our offsets in place
  65. 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),
  66. e.globalAlpha=1;
  67. }
  68. else //for everything else do whatever it normally does
  69. {
  70. old(e,t,n,r,i,s,o);
  71. }
  72. }
  73.  
  74.  
  75. }, 500);
  76.  
  77. tagpro.events.register({
  78. drawPlayer: function(player, context, drawPos, TILESIZE) {
  79. if (player.team == 1)
  80. context.drawImage(image, 0 * 40, 0, 40, 40, drawPos.x, drawPos.y, 40 / tagpro.zoom, 40 / tagpro.zoom);
  81. if (player.team == 2)
  82. context.drawImage(image, 1 * 40, 0, 40, 40, drawPos.x, drawPos.y, 40 / tagpro.zoom, 40 / tagpro.zoom)
  83.  
  84. if (player.tagpro)
  85. context.drawImage(image, 2 * 40, 0, 40, 40 , drawPos.x, drawPos.y, 40 / tagpro.zoom, 40 / tagpro.zoom);
  86.  
  87. if (player.bomb && Math.round(Math.random() * 4) == 1) {
  88. context.globalAlpha = 0.7;
  89. context.drawImage(image, 3 * 40, 0, 40, 40 , drawPos.x, drawPos.y, 40 / tagpro.zoom, 40 / tagpro.zoom);
  90. context.globalAlpha = 1;
  91. }
  92. }
  93. });
  94. });
Advertisement
Add Comment
Please, Sign In to add comment