Advertisement
Guest User

Untitled

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