shh214

tagpropro.honeybear.js

Nov 16th, 2015
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.43 KB | None | 0 0
  1. // ==UserScript==
  2. // @name TagPro Pro
  3. // @description Spin marble overlay, pixel perfect tagpro and textures.
  4. // @version 3
  5. // @grant none
  6. // @include http://tagpro-*.koalabeast.com:*
  7. // @include http://tangent.jukejuice.com:*
  8. // @include http://*.newcompte.fr:*
  9. // @license 2014
  10. // @author CFlakes, SomeBall -1, modified by Ballsagnia
  11. // @namespace http://www.reddit.com/user/Cumflakes
  12. // ==/UserScript==
  13.  
  14. $('#tiles')[0].src = 'http://i.imgur.com/oMBud3r.png';
  15. $('#splats')[0].src = 'http://i.imgur.com/H2V1eJ7.png';
  16. $('#speedpad')[0].src = 'http://i.imgur.com/GztPeEh.png';
  17. $('#speedpadred')[0].src = 'http://i.imgur.com/ZsoItwA.png';
  18. $('#speedpadblue')[0].src = 'http://i.imgur.com/9joPsYb.png';
  19. $('#portal')[0].src = 'http://i.imgur.com/qPjNm7V.png';
  20.  
  21. tagpro.ready(function () {
  22. var texture = PIXI.Texture.fromImage('http://i.imgur.com/h6ouK1x.png'),
  23. redTexture = new PIXI.Texture(texture, new PIXI.Rectangle(0, 0, 40, 40)),
  24. blueTexture = new PIXI.Texture(texture, new PIXI.Rectangle(40, 0, 40, 40)),
  25. tagproTexture = new PIXI.Texture(texture, new PIXI.Rectangle(80, 0, 40, 40));
  26. tagpro.renderer.createSpin = function(player) {
  27. var teamTexture = player.team === 1 ? redTexture : blueTexture;
  28. if (!player.sprites.spin) {
  29. player.sprites.spin = new PIXI.Sprite(teamTexture);
  30. player.sprites.spin.anchor.x = 0.5;
  31. player.sprites.spin.anchor.y = 0.5;
  32. player.sprites.spin.x = 20;
  33. player.sprites.spin.y = 20;
  34. player.sprites.spin.tileId = player.sprites.actualBall.tileId;
  35. player.sprites.ball.addChild(player.sprites.spin);
  36. } else {
  37. player.sprites.spin.setTexture(teamTexture);
  38. player.sprites.spin.tileId = player.sprites.actualBall.tileId;
  39. }
  40. };
  41. var upsp = tagpro.renderer.updatePlayerSpritePosition;
  42. tagpro.renderer.updatePlayerSpritePosition = function(player) {
  43. if (!player.sprites.spin || player.sprites.actualBall.tileId !== player.sprites.spin.tileId) tagpro.renderer.createSpin(player);
  44. player.sprites.spin.rotation = player.angle;
  45. upsp(player);
  46. };
  47. tagpro.renderer.createBallSprite = function(player) {
  48. var texture = player.team === 1 ? "redball" : "blueball";
  49. player.sprites.actualBall = tagpro.tiles.draw(player.sprites.ball, texture, {x: 0, y: 0});
  50. player.sprites.actualBall.tileId = texture;
  51. };
  52. tagpro.renderer.updateTagpro = function(player) {
  53. if (player.tagpro) {
  54. if (!tagpro.renderer.options.disableParticles && !player.sprites.tagproSparks) {
  55. player.sprites.tagproSparks = new cloudkid.Emitter(
  56. player.sprites.ball,
  57. [tagpro.renderer.particleFireTexture],
  58. tagpro.particleDefinitions.tagproSparks);
  59. tagpro.renderer.emitters.push(player.sprites.tagproSparks);
  60. }
  61. if (player.bomb) {
  62. if (player.sprites.tagproTint) {
  63. player.sprites.ball.removeChild(player.sprites.tagproTint);
  64. player.sprites.tagproTint = null;
  65. }
  66. } else {
  67. if (!player.sprites.tagproTint) {
  68. player.sprites.tagproTint = new PIXI.Graphics();
  69. player.sprites.tagproTint.beginFill(0x00FF00, 0.25).drawCircle(20, 20, 19);
  70. player.sprites.ball.addChild(player.sprites.tagproTint);
  71. }
  72. }
  73. if (!player.sprites.tagproTexture) {
  74. player.sprites.tagproTexture = new PIXI.Sprite(tagproTexture);
  75. player.sprites.ball.addChild(player.sprites.tagproTexture);
  76. player.sprites.tagproTexture.anchor.x = 0.5;
  77. player.sprites.tagproTexture.anchor.y = 0.5;
  78. player.sprites.tagproTexture.x = 20;
  79. player.sprites.tagproTexture.y = 20;
  80. }
  81. player.sprites.tagproTexture.rotation = player.angle;
  82. } else {
  83. if (player.sprites.tagproTint || player.sprites.tagproTexture) {
  84. player.sprites.ball.removeChild(player.sprites.tagproTint);
  85. player.sprites.ball.removeChild(player.sprites.tagproTexture);
  86. player.sprites.tagproTint = null;
  87. player.sprites.tagproTexture = null;
  88. }
  89. if (player.sprites.tagproSparks) {
  90. player.sprites.tagproSparks.emit = false;
  91. var sparksIndex = tagpro.renderer.emitters.indexOf(player.sprites.tagproSparks);
  92. tagpro.renderer.emitters.splice(sparksIndex, 1);
  93. player.sprites.tagproSparks.destroy();
  94. player.sprites.tagproSparks = null;
  95. }
  96. }
  97. };
  98. tagpro.renderer.updateRollingBomb = function(player) {
  99. if (player.bomb) {
  100. if (!player.sprites.bomb) {
  101. if (!tagpro.renderer.options.disableParticles) {
  102. player.sprites.rollingBomb = new cloudkid.Emitter(
  103. player.sprites.ball,
  104. [tagpro.renderer.particleTexture],
  105. tagpro.particleDefinitions.rollingBomb);
  106. tagpro.renderer.emitters.push(player.sprites.rollingBomb);
  107. }
  108. var bomb = player.sprites.bomb = new PIXI.Graphics();
  109. bomb.beginFill(0xFFFF00, 0.6).drawCircle(20, 20, 19);
  110. player.sprites.ball.addChild(bomb);
  111. } else {
  112. player.sprites.bomb.alpha = Math.abs(0.6 * Math.sin(performance.now() / 150));
  113. }
  114. } else {
  115. if (player.sprites.bomb) {
  116. player.sprites.ball.removeChild(player.sprites.bomb);
  117. player.sprites.bomb = null;
  118. }
  119. if (player.sprites.rollingBomb) {
  120. if (player.sprites.rollingBomb instanceof cloudkid.Emitter) {
  121. player.sprites.rollingBomb.emit = false;
  122. tagpro.renderer.emitters.splice(tagpro.renderer.emitters.indexOf(player.sprites.rollingBomb), 1);
  123. player.sprites.rollingBomb.destroy();
  124. } else {
  125. player.sprites.rollingBomb.visible = false;
  126. }
  127. player.sprites.rollingBomb = null;
  128. }
  129. }
  130. };
  131. });
Add Comment
Please, Sign In to add comment