SHARE
TWEET

Untitled

a guest Jan 24th, 2020 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. function startRoom()
  3. {
  4.     SHELL.addListener(SHELL.PLAYER_MOVE, handlePlayerMove);
  5.     SHELL.addListener(SHELL.PLAYER_MOVE_DONE, handlePlayerMoveDone);
  6.     AIRTOWER.addListener("gz", handleGetGame);
  7.     AIRTOWER.addListener("zm", handleGameMove);
  8.     getGame();
  9. }
  10. function destroyRoom()
  11. {
  12.     SHELL.removeListener(SHELL.PLAYER_MOVE, handlePlayerMove);
  13.     SHELL.removeListener(SHELL.PLAYER_MOVE_DONE, handlePlayerMoveDone);
  14.     AIRTOWER.removeListener("gz", handleGetGame);
  15.     AIRTOWER.removeListener("zm", handleGameMove);
  16. }
  17. function getGame()
  18. {
  19.     AIRTOWER.send("z", "gz", [], "str", SHELL.getCurrentServerRoomId());
  20. }
  21. function handleGetGame(ob)
  22. {
  23.     var __reg4 = Number(ob[0]);
  24.     var __reg2 = Number(ob[1]);
  25.     var __reg3 = Number(ob[2]);
  26.     hockey.HockeyGame.controller.hitPuck(__reg2, __reg3, 0, 0);
  27. }
  28. function sendGameMove(x, y, speed_x, speed_y)
  29. {
  30.     var __reg1 = SHELL.getMyPlayerId();
  31.     AIRTOWER.send("z", "m", [__reg1, x, y, speed_x, speed_y], "str", SHELL.getCurrentServerRoomId());
  32. }
  33. function handleGameMove(ob)
  34. {
  35.     var __reg7 = Number(ob[0]);
  36.     var __reg6 = Number(ob[1]);
  37.     var __reg5 = Number(ob[2]);
  38.     var __reg4 = Number(ob[3]);
  39.     var __reg3 = Number(ob[4]);
  40.     var __reg2 = Number(ob[5]);
  41.     hockey.HockeyGame.controller.hitPuck(__reg5, __reg4, __reg3, __reg2);
  42. }
  43. function handleGameMoveDone()
  44. {
  45.     if (GAME.puck_mc.is_moving)
  46.     {
  47.         trace("PUCK STOPPED");
  48.         GAME.puck_mc.is_moving = false;
  49.     }
  50. }
  51. function handlePlayerMove(player_ob)
  52. {
  53.     trace("handlePlayerMove");
  54.     var __reg1 = player_ob.player_id;
  55.     if (SHELL.isMyPlayer(__reg1))
  56.     {
  57.         GAME.player_mc = ENGINE.getPlayerMovieClip(__reg1);
  58.         GAME.target_x = player_ob.x;
  59.         GAME.target_y = player_ob.y;
  60.         GAME.onEnterFrame = movePlayer;
  61.     }
  62. }
  63. function handlePlayerMoveDone(player_ob)
  64. {
  65.     trace("handlePlayerMoveDone");
  66.     var __reg1 = player_ob.player_id;
  67.     if (SHELL.isMyPlayer(__reg1))
  68.     {
  69.         GAME.onEnterFrame = undefined;
  70.         delete GAME.onEnterFrame;
  71.     }
  72. }
  73. function movePlayer()
  74. {
  75.     var __reg9 = GAME.player_mc._x;
  76.     var __reg8 = GAME.player_mc._y;
  77.     if (GAME.puck_mc.hitTest(__reg9, __reg8, true))
  78.     {
  79.         var __reg2 = Math.round(GAME.puck_mc._x);
  80.         var __reg1 = Math.round(GAME.puck_mc._y);
  81.         var __reg3 = GAME.target_x - GAME._x;
  82.         var __reg4 = GAME.target_y - GAME._y;
  83.         var __reg5 = findDistance(__reg3, __reg4, __reg2, __reg1);
  84.         if (__reg5 > 20)
  85.         {
  86.             GAME.puck_mc.is_moving = true;
  87.             var __reg7 = Math.floor((__reg3 - __reg2) / 6);
  88.             var __reg6 = Math.floor((__reg4 - __reg1) / 6);
  89.             sendGameMove(__reg2, __reg1, __reg7, __reg6);
  90.             GAME.onEnterFrame = undefined;
  91.             delete GAME.onEnterFrame;
  92.         }
  93.     }
  94. }
  95. function findDistance(x1, y1, x2, y2)
  96. {
  97.     var __reg2 = x2 - x1;
  98.     var __reg1 = y2 - y1;
  99.     return Math.sqrt(__reg2 * __reg2 + __reg1 * __reg1);
  100. }
  101. var SHELL = _global.getCurrentShell();
  102. var ENGINE = _global.getCurrentEngine();
  103. var AIRTOWER = _global.getCurrentAirtower();
  104. var start_x = 390;
  105. var start_y = 280;
  106. var ease_method = "easeInOutQuad";
  107. triggers_mc.forts_mc.triggerFunction = function ()
  108. {
  109.     ENGINE.sendJoinRoom("forts", 280, 200);
  110. }
  111. ;
  112. door_mc.forts_btn.onRelease = function ()
  113. {
  114.     ENGINE.sendPlayerMove(380, 100);
  115. }
  116. ;
  117. ENGINE.setRoomBallMovieClip(game_mc.puck_mc);
  118. triggers_mc._visible = false;
  119. block_mc._visible = false;
  120. var GAME = game_mc;
  121. GAME.puck_mc.is_moving = false;
  122. hockey.HockeyGame.setContainer(GAME);
  123. hockey.HockeyGame.controller.puckDone = handleGameMoveDone;
  124. var SHELL = _global.getCurrentShell();
  125. var language;
  126. var localized_frame = 1;
  127. if (SHELL.getLocalizedFrame != undefined)
  128. {
  129.     localized_frame = SHELL.getLocalizedFrame();
  130. }
  131. if ((__reg0 = localized_frame) === 1)
  132. {
  133.     language = "english";
  134. }
  135. else if (__reg0 === 2)
  136. {
  137.     language = "portuguese";
  138. }
  139. else if (__reg0 === 3)
  140. {
  141.     language = "french";
  142. }
  143. else if (__reg0 === 4)
  144. {
  145.     language = "spanish";
  146. }
  147. else
  148. {
  149.     language = "english";
  150. }
  151. background_mc.arenasign_mc.gotoAndStop(language);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top