UserNameWTF

Cam'sPP Balls for Light Tiles (TagPro Pro)

Oct 8th, 2014
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.11 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Cam'sPP Balls for Light Tiles (TagPro Pro)
  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.  
  19. // Ball textures
  20. // If you want a transparent ball, replace the URL with this: http://i.imgur.com/YxgxezW.png
  21. // If you want an opaque ball, replace the URL with this (Defualt): http://i.imgur.com/UOrWEoU.png
  22. var image = new Image();
  23. image.src = "http://i.imgur.com/UOrWEoU.png";
  24.  
  25. tagpro.events.register({
  26. drawPlayer: function(player, context, drawPos, TILESIZE) {
  27. if (player.team == 1)
  28. context.drawImage(image, 3 * 40, 0, 40, 40, drawPos.x, drawPos.y, 40 / tagpro.zoom, 40 / tagpro.zoom);
  29. if (player.team == 2)
  30. context.drawImage(image, 1 * 40, 0, 40, 40, drawPos.x, drawPos.y, 40 / tagpro.zoom, 40 / tagpro.zoom);
  31.  
  32. var radian = (Math.PI / 180),
  33. points = [],
  34. angle = (player.angle/radian % 360)+360;
  35.  
  36. for (i = 0; i < 8; i++) {
  37. var iAngle = angle + 360 / 4 * i,
  38. side = ((iAngle + 270) % 360 > 180) ? 0 : -0,
  39. outerAngle = (iAngle + 90) % 180,
  40. outerAngle = (side > 0) ? 180 - outerAngle : outerAngle,
  41. offset = (-8.546e-10 * Math.pow(outerAngle, 5)
  42. + 4.311e-7 * Math.pow(outerAngle, 4)
  43. - 6.669e-5 * Math.pow(outerAngle, 3)
  44. + 0.001099 * Math.pow(outerAngle, 2)
  45. + 0.3462 * outerAngle),
  46. innerX = 18 * Math.cos(iAngle * radian) / tagpro.zoom,
  47. innerY = 18 * Math.sin(iAngle * radian) / tagpro.zoom,
  48. outerX = 30 * Math.cos((iAngle + offset * side) * radian) / tagpro.zoom,
  49. outerY = 30 * Math.sin((iAngle + offset * side) * radian) / tagpro.zoom;
  50. points.push({ix: innerX, iy: innerY, ox: outerX, oy: outerY});
  51. }
  52.  
  53. for (i = 0; i < points.length; i += 2) {
  54. var color = (player.team == 1) ? 2 : 0;
  55. first = points[i],
  56. second = points[(i + 1) % points.length];
  57. context.save();
  58. context.beginPath();
  59. context.moveTo(drawPos.x + 20 / tagpro.zoom, drawPos.y + 20 / tagpro.zoom);
  60. context.quadraticCurveTo(drawPos.x + first.ix + 20 / tagpro.zoom, drawPos.y + first.iy + 20 / tagpro.zoom, drawPos.x + first.ox + 20 / tagpro.zoom, drawPos.y + first.oy + 20 / tagpro.zoom);
  61. context.lineTo(drawPos.x + second.ox + 20 / tagpro.zoom, drawPos.y + second.oy + 20 / tagpro.zoom);
  62. context.quadraticCurveTo(drawPos.x + second.ix + 20 / tagpro.zoom, drawPos.y + second.iy + 20 / tagpro.zoom, drawPos.x + 20 / tagpro.zoom, drawPos.y + 20 / tagpro.zoom);
  63. context.clip();
  64. context.drawImage(image, color * 40, 0, 40, 40 , drawPos.x, drawPos.y, 40 / tagpro.zoom, 40 / tagpro.zoom);
  65. context.restore();
  66. context.closePath();
  67. }
  68.  
  69. if (player.tagpro)
  70. context.drawImage(image, 4 * 40, 0, 40, 40, drawPos.x, drawPos.y, 40 / tagpro.zoom, 40 / tagpro.zoom);
  71.  
  72. if (player.bomb && Math.round(Math.random() * 4) == 1) {
  73. context.globalAlpha = 0.7;
  74. context.drawImage(image, 5 * 40, 0, 40, 40, drawPos.x, drawPos.y, 40 / tagpro.zoom, 40 / tagpro.zoom);
  75. context.globalAlpha = 1;
  76. }
  77. }
  78. });
  79. });
Advertisement
Add Comment
Please, Sign In to add comment