Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.00 KB | None | 0 0
  1. //NintendoLand Luigi's Ghost Mansion (Ghost Player) aka main SERVER
  2. //Keane Tan
  3. //Mr. Cadawas
  4. //Version Alpha v0.0.1
  5.  
  6. import java.awt.*;
  7. import java.awt.event.*;
  8. import javax.swing.*;
  9. import javax.swing.event.*;
  10.  
  11. public class cptserver implements ActionListener, KeyListener, MouseListener, MouseMotionListener {
  12.  
  13. //GUI Main Properties
  14. JFrame theframe;
  15. JAnimation thepanel;
  16. Timer thetimer;
  17. SuperSocketMaster ssm;
  18.  
  19. //Game Variable Properties
  20. int intPlayerCount = 1;
  21.  
  22.  
  23. //Main String Array for splitting nettexts
  24. //Net Text Format: [commands][playernumber][ghostcommand][ghostx][ghosty][p1command][p1movecommand][p1x][p1y][p2command][p2movecommand][p2x][p2y][p3command][p3movecommand][p3x][p3y][p4command][p4movecommand][p4x][p4y] 21 array or 20 **add more test features first
  25. String strNetText[] = new String[20];
  26.  
  27. //Methods
  28. public void actionPerformed(ActionEvent evt){
  29.  
  30. if (evt.getSource() == thetimer){
  31. int GhostX = thepanel.GhostX;
  32. int GhostY = thepanel.GhostY;
  33. int P1X = thepanel.P1X;
  34. int P1Y = thepanel.P1Y;
  35. int P2X = thepanel.P2X;
  36. int P2Y = thepanel.P2Y;
  37. int P3X = thepanel.P3X;
  38. int P3Y = thepanel.P3Y;
  39. int P4X = thepanel.P4X;
  40. int P4Y = thepanel.P4Y;
  41. ssm.sendText(" , ,GhostMove,"+GhostX+","+GhostY+",P1Move, ,"+P1X+","+P1Y+",P2Move, ,"+P2X+","+P2Y+",P3Move, ,"+P3X+","+P3Y+",P4Move, ,"+P4X+","+P4Y);
  42. thepanel.repaint();
  43. //System.out.println (ssm.readText());
  44.  
  45. }
  46. if (evt.getSource() == ssm){
  47. String strNetText[] = ssm.readText().split(",");
  48.  
  49. //Write all code for super socket master SERVER below!!
  50.  
  51. if (strNetText[0].equalsIgnoreCase("connect")){
  52. if (intPlayerCount == 1){
  53. ssm.sendText("Connected,1,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move, ,"+thepanel.P1X+","+thepanel.P1Y+",P2Move, ,"+thepanel.P2X+","+thepanel.P2Y+",P3Move, ,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, ,"+thepanel.P4X+","+thepanel.P4Y);
  54. intPlayerCount++;
  55. } else if (intPlayerCount == 2){
  56. ssm.sendText("Connected,2,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move, ,"+thepanel.P1X+","+thepanel.P1Y+",P2Move, ,"+thepanel.P2X+","+thepanel.P2Y+",P3Move, ,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, ,"+thepanel.P4X+","+thepanel.P4Y);
  57. intPlayerCount++;
  58. } else if (intPlayerCount == 3){
  59. ssm.sendText("Connected,3,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move, ,"+thepanel.P1X+","+thepanel.P1Y+",P2Move, ,"+thepanel.P2X+","+thepanel.P2Y+",P3Move, ,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, ,"+thepanel.P4X+","+thepanel.P4Y);
  60. intPlayerCount++;
  61. } else if (intPlayerCount == 4){
  62. ssm.sendText("Connected,4,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move, ,"+thepanel.P1X+","+thepanel.P1Y+",P2Move, ,"+thepanel.P2X+","+thepanel.P2Y+",P3Move, ,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, ,"+thepanel.P4X+","+thepanel.P4Y);
  63.  
  64. intPlayerCount++;
  65. }
  66. thepanel.intPlayerCount = intPlayerCount - 1;
  67. }
  68.  
  69. //Moving for Players and code for flashlight
  70.  
  71. //PLAYER 1----------------------------------------------------------
  72. if (strNetText[6].equalsIgnoreCase("up")){
  73. thepanel.P1Up = true;
  74. } else if (strNetText[6].equalsIgnoreCase("down")){
  75. thepanel.P1Down = true;
  76. } else if (strNetText[6].equalsIgnoreCase("left")){
  77. thepanel.P1Left = true;
  78. } else if (strNetText[6].equalsIgnoreCase("right")){
  79. thepanel.P1Right = true;
  80. } else if (strNetText[6].equalsIgnoreCase("upfalse")){
  81. thepanel.P1Up = false;
  82. } else if (strNetText[6].equalsIgnoreCase("downfalse")){
  83. thepanel.P1Down = false;
  84. } else if (strNetText[6].equalsIgnoreCase("leftfalse")){
  85. thepanel.P1Left = false;
  86. } else if (strNetText[6].equalsIgnoreCase("rightfalse")){
  87. thepanel.P1Right = false;
  88. } else if (strNetText[6].equalsIgnoreCase("uplighton")){
  89. thepanel.P1FlashlightUp = true;
  90. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move,uplighton,"+thepanel.P1X+","+thepanel.P1Y+",P2Move, ,"+thepanel.P2X+","+thepanel.P2Y+",P3Move, ,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, ,"+thepanel.P4X+","+thepanel.P4Y);
  91. } else if (strNetText[6].equalsIgnoreCase("leftlighton")){
  92. thepanel.P1FlashlightLeft = true;
  93. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move,leftlighton,"+thepanel.P1X+","+thepanel.P1Y+",P2Move, ,"+thepanel.P2X+","+thepanel.P2Y+",P3Move, ,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, ,"+thepanel.P4X+","+thepanel.P4Y);
  94. } else if (strNetText[6].equalsIgnoreCase("downlighton")){
  95. thepanel.P1FlashlightDown = true;
  96. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move,downlighton,"+thepanel.P1X+","+thepanel.P1Y+",P2Move, ,"+thepanel.P2X+","+thepanel.P2Y+",P3Move, ,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, ,"+thepanel.P4X+","+thepanel.P4Y);
  97. } else if (strNetText[6].equalsIgnoreCase("rightlighton")){
  98. thepanel.P1FlashlightRight = true;
  99. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move,rightlighton,"+thepanel.P1X+","+thepanel.P1Y+",P2Move, ,"+thepanel.P2X+","+thepanel.P2Y+",P3Move, ,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, ,"+thepanel.P4X+","+thepanel.P4Y);
  100. } else if (strNetText[6].equalsIgnoreCase("uplightoff")){
  101. thepanel.P1FlashlightUp = false;
  102. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move,uplightoff,"+thepanel.P1X+","+thepanel.P1Y+",P2Move, ,"+thepanel.P2X+","+thepanel.P2Y+",P3Move, ,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, ,"+thepanel.P4X+","+thepanel.P4Y);
  103. } else if (strNetText[6].equalsIgnoreCase("leftlightoff")){
  104. thepanel.P1FlashlightLeft = false;
  105. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move,leftlightoff,"+thepanel.P1X+","+thepanel.P1Y+",P2Move, ,"+thepanel.P2X+","+thepanel.P2Y+",P3Move, ,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, ,"+thepanel.P4X+","+thepanel.P4Y);
  106. } else if (strNetText[6].equalsIgnoreCase("downlightoff")){
  107. thepanel.P1FlashlightDown = false;
  108. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move,downlightoff,"+thepanel.P1X+","+thepanel.P1Y+",P2Move, ,"+thepanel.P2X+","+thepanel.P2Y+",P3Move, ,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, ,"+thepanel.P4X+","+thepanel.P4Y);
  109. } else if (strNetText[6].equalsIgnoreCase("rightlightoff")){
  110. thepanel.P1FlashlightRight = false;
  111. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move,rightlightoff,"+thepanel.P1X+","+thepanel.P1Y+",P2Move, ,"+thepanel.P2X+","+thepanel.P2Y+",P3Move, ,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, ,"+thepanel.P4X+","+thepanel.P4Y);
  112. }
  113.  
  114. //PLAYER 2----------------------------------------------------------
  115. if (strNetText[10].equalsIgnoreCase("up")){
  116. thepanel.P2Up = true;
  117. } else if (strNetText[10].equalsIgnoreCase("down")){
  118. thepanel.P2Down = true;
  119. } else if (strNetText[10].equalsIgnoreCase("left")){
  120. thepanel.P2Left = true;
  121. } else if (strNetText[10].equalsIgnoreCase("right")){
  122. thepanel.P2Right = true;
  123. } else if (strNetText[10].equalsIgnoreCase("upfalse")){
  124. thepanel.P2Up = false;
  125. } else if (strNetText[10].equalsIgnoreCase("downfalse")){
  126. thepanel.P2Down = false;
  127. } else if (strNetText[10].equalsIgnoreCase("leftfalse")){
  128. thepanel.P2Left = false;
  129. } else if (strNetText[10].equalsIgnoreCase("rightfalse")){
  130. thepanel.P2Right = false;
  131. } else if (strNetText[10].equalsIgnoreCase("uplighton")){
  132. thepanel.P2FlashlightUp = true;
  133. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move, ,"+thepanel.P1X+","+thepanel.P1Y+",P2Move,uplighton,"+thepanel.P2X+","+thepanel.P2Y+",P3Move, ,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, ,"+thepanel.P4X+","+thepanel.P4Y);
  134. } else if (strNetText[10].equalsIgnoreCase("leftlighton")){
  135. thepanel.P2FlashlightLeft = true;
  136. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move, ,"+thepanel.P1X+","+thepanel.P1Y+",P2Move,leftlighton,"+thepanel.P2X+","+thepanel.P2Y+",P3Move, ,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, ,"+thepanel.P4X+","+thepanel.P4Y);
  137. } else if (strNetText[10].equalsIgnoreCase("downlighton")){
  138. thepanel.P2FlashlightDown = true;
  139. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move, ,"+thepanel.P1X+","+thepanel.P1Y+",P2Move,downlighton,"+thepanel.P2X+","+thepanel.P2Y+",P3Move, ,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, ,"+thepanel.P4X+","+thepanel.P4Y);
  140. } else if (strNetText[10].equalsIgnoreCase("rightlighton")){
  141. thepanel.P2FlashlightRight = true;
  142. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move, ,"+thepanel.P1X+","+thepanel.P1Y+",P2Move,rightlighton,"+thepanel.P2X+","+thepanel.P2Y+",P3Move, ,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, ,"+thepanel.P4X+","+thepanel.P4Y);
  143. } else if (strNetText[10].equalsIgnoreCase("uplightoff")){
  144. thepanel.P2FlashlightUp = false;
  145. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move, ,"+thepanel.P1X+","+thepanel.P1Y+",P2Move,uplightoff,"+thepanel.P2X+","+thepanel.P2Y+",P3Move, ,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, ,"+thepanel.P4X+","+thepanel.P4Y);
  146. } else if (strNetText[10].equalsIgnoreCase("leftlightoff")){
  147. thepanel.P2FlashlightLeft = false;
  148. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move, ,"+thepanel.P1X+","+thepanel.P1Y+",P2Move,leftlightoff,"+thepanel.P2X+","+thepanel.P2Y+",P3Move, ,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, ,"+thepanel.P4X+","+thepanel.P4Y);
  149. } else if (strNetText[10].equalsIgnoreCase("downlightoff")){
  150. thepanel.P2FlashlightDown = false;
  151. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move, ,"+thepanel.P1X+","+thepanel.P1Y+",P2Move,downlightoff,"+thepanel.P2X+","+thepanel.P2Y+",P3Move, ,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, ,"+thepanel.P4X+","+thepanel.P4Y);
  152. } else if (strNetText[10].equalsIgnoreCase("rightlightoff")){
  153. thepanel.P2FlashlightRight = false;
  154. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move, ,"+thepanel.P1X+","+thepanel.P1Y+",P2Move,rightlightoff,"+thepanel.P2X+","+thepanel.P2Y+",P3Move, ,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, ,"+thepanel.P4X+","+thepanel.P4Y);
  155. }
  156.  
  157. //PLAYER 3-------------------------------------------------------
  158. if (strNetText[14].equalsIgnoreCase("up")){
  159. thepanel.P3Up = true;
  160. } else if (strNetText[14].equalsIgnoreCase("down")){
  161. thepanel.P3Down = true;
  162. } else if (strNetText[14].equalsIgnoreCase("left")){
  163. thepanel.P3Left = true;
  164. } else if (strNetText[14].equalsIgnoreCase("right")){
  165. thepanel.P3Right = true;
  166. } else if (strNetText[14].equalsIgnoreCase("upfalse")){
  167. thepanel.P3Up = false;
  168. } else if (strNetText[14].equalsIgnoreCase("downfalse")){
  169. thepanel.P3Down = false;
  170. } else if (strNetText[14].equalsIgnoreCase("leftfalse")){
  171. thepanel.P3Left = false;
  172. } else if (strNetText[14].equalsIgnoreCase("rightfalse")){
  173. thepanel.P3Right = false;
  174. } else if (strNetText[14].equalsIgnoreCase("uplighton")){
  175. thepanel.P3FlashlightUp = true;
  176. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move, ,"+thepanel.P1X+","+thepanel.P1Y+",P2Move, ,"+thepanel.P2X+","+thepanel.P2Y+",P3Move,uplighton,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, ,"+thepanel.P4X+","+thepanel.P4Y);
  177. } else if (strNetText[14].equalsIgnoreCase("leftlighton")){
  178. thepanel.P3FlashlightLeft = true;
  179. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move, ,"+thepanel.P1X+","+thepanel.P1Y+",P2Move, ,"+thepanel.P2X+","+thepanel.P2Y+",P3Move,leftlighton,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, ,"+thepanel.P4X+","+thepanel.P4Y);
  180. } else if (strNetText[14].equalsIgnoreCase("downlighton")){
  181. thepanel.P3FlashlightDown = true;
  182. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move, ,"+thepanel.P1X+","+thepanel.P1Y+",P2Move, ,"+thepanel.P2X+","+thepanel.P2Y+",P3Move,downlighton,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, ,"+thepanel.P4X+","+thepanel.P4Y);
  183. } else if (strNetText[14].equalsIgnoreCase("rightlighton")){
  184. thepanel.P3FlashlightRight = true;
  185. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move, ,"+thepanel.P1X+","+thepanel.P1Y+",P2Move, ,"+thepanel.P2X+","+thepanel.P2Y+",P3Move,rightlighton,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, ,"+thepanel.P4X+","+thepanel.P4Y);
  186. } else if (strNetText[14].equalsIgnoreCase("uplightoff")){
  187. thepanel.P3FlashlightUp = false;
  188. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move, ,"+thepanel.P1X+","+thepanel.P1Y+",P2Move, ,"+thepanel.P2X+","+thepanel.P2Y+",P3Move,uplightoff,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, ,"+thepanel.P4X+","+thepanel.P4Y);
  189. } else if (strNetText[14].equalsIgnoreCase("leftlightoff")){
  190. thepanel.P3FlashlightLeft = false;
  191. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move, ,"+thepanel.P1X+","+thepanel.P1Y+",P2Move, ,"+thepanel.P2X+","+thepanel.P2Y+",P3Move,leftlightoff,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, ,"+thepanel.P4X+","+thepanel.P4Y);
  192. } else if (strNetText[14].equalsIgnoreCase("downlightoff")){
  193. thepanel.P3FlashlightDown = false;
  194. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move, ,"+thepanel.P1X+","+thepanel.P1Y+",P2Move, ,"+thepanel.P2X+","+thepanel.P2Y+",P3Move,downlightoff,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, ,"+thepanel.P4X+","+thepanel.P4Y);
  195. } else if (strNetText[14].equalsIgnoreCase("rightlightoff")){
  196. thepanel.P3FlashlightRight = false;
  197. } ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move, ,"+thepanel.P1X+","+thepanel.P1Y+",P2Move, ,"+thepanel.P2X+","+thepanel.P2Y+",P3Move,rightlightoff,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, ,"+thepanel.P4X+","+thepanel.P4Y);
  198.  
  199. //PLAYER 4--------------------------------------------------------
  200. if (strNetText[18].equalsIgnoreCase("up")){
  201. thepanel.P4Up = true;
  202. } else if (strNetText[18].equalsIgnoreCase("down")){
  203. thepanel.P4Down = true;
  204. } else if (strNetText[18].equalsIgnoreCase("left")){
  205. thepanel.P4Left = true;
  206. } else if (strNetText[18].equalsIgnoreCase("right")){
  207. thepanel.P4Right = true;
  208. } else if (strNetText[18].equalsIgnoreCase("upfalse")){
  209. thepanel.P4Up = false;
  210. } else if (strNetText[18].equalsIgnoreCase("downfalse")){
  211. thepanel.P4Down = false;
  212. } else if (strNetText[18].equalsIgnoreCase("leftfalse")){
  213. thepanel.P4Left = false;
  214. } else if (strNetText[18].equalsIgnoreCase("rightfalse")){
  215. thepanel.P4Right = false;
  216. } else if (strNetText[18].equalsIgnoreCase("uplighton")){
  217. thepanel.P2FlashlightUp = true;
  218. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move, ,"+thepanel.P1X+","+thepanel.P1Y+",P2Move, ,"+thepanel.P2X+","+thepanel.P2Y+",P3Move, ,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, uplighton,"+thepanel.P4X+","+thepanel.P4Y);
  219. } else if (strNetText[18].equalsIgnoreCase("leftlighton")){
  220. thepanel.P2FlashlightLeft = true;
  221. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move, ,"+thepanel.P1X+","+thepanel.P1Y+",P2Move, ,"+thepanel.P2X+","+thepanel.P2Y+",P3Move, ,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, leftlighton,"+thepanel.P4X+","+thepanel.P4Y);
  222. } else if (strNetText[18].equalsIgnoreCase("downlighton")){
  223. thepanel.P2FlashlightDown = true;
  224. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move, ,"+thepanel.P1X+","+thepanel.P1Y+",P2Move, ,"+thepanel.P2X+","+thepanel.P2Y+",P3Move, ,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, downlighton,"+thepanel.P4X+","+thepanel.P4Y);
  225. } else if (strNetText[18].equalsIgnoreCase("rightlighton")){
  226. thepanel.P2FlashlightRight = true;
  227. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move, ,"+thepanel.P1X+","+thepanel.P1Y+",P2Move, ,"+thepanel.P2X+","+thepanel.P2Y+",P3Move, ,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, rightlighton,"+thepanel.P4X+","+thepanel.P4Y);
  228. } else if (strNetText[18].equalsIgnoreCase("uplightoff")){
  229. thepanel.P2FlashlightUp = false;
  230. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move, ,"+thepanel.P1X+","+thepanel.P1Y+",P2Move, ,"+thepanel.P2X+","+thepanel.P2Y+",P3Move, ,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, uplightoff,"+thepanel.P4X+","+thepanel.P4Y);
  231. } else if (strNetText[18].equalsIgnoreCase("leftlightoff")){
  232. thepanel.P2FlashlightLeft = false;
  233. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move, ,"+thepanel.P1X+","+thepanel.P1Y+",P2Move, ,"+thepanel.P2X+","+thepanel.P2Y+",P3Move, ,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, leftlightoff,"+thepanel.P4X+","+thepanel.P4Y);
  234. } else if (strNetText[18].equalsIgnoreCase("downlightoff")){
  235. thepanel.P2FlashlightDown = false;
  236. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move, ,"+thepanel.P1X+","+thepanel.P1Y+",P2Move, ,"+thepanel.P2X+","+thepanel.P2Y+",P3Move, ,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, rightlightoff,"+thepanel.P4X+","+thepanel.P4Y);
  237. } else if (strNetText[18].equalsIgnoreCase("rightlightoff")){
  238. thepanel.P2FlashlightRight = false;
  239. ssm.sendText(" , ,GhostMove,"+thepanel.GhostX+","+thepanel.GhostY+",P1Move, ,"+thepanel.P1X+","+thepanel.P1Y+",P2Move, ,"+thepanel.P2X+","+thepanel.P2Y+",P3Move, ,"+thepanel.P3X+","+thepanel.P3Y+",P4Move, downlightoff,"+thepanel.P4X+","+thepanel.P4Y);
  240. }
  241. }
  242.  
  243.  
  244. }
  245. public void mouseExited(MouseEvent evt){
  246. }
  247. public void mouseEntered(MouseEvent evt){
  248. }
  249. public void mouseReleased(MouseEvent evt){
  250. }
  251. public void mousePressed(MouseEvent evt){
  252. }
  253. public void mouseClicked(MouseEvent evt){
  254. }
  255. public void mouseMoved(MouseEvent evt){
  256. }
  257. public void mouseDragged(MouseEvent evt){
  258. }
  259. public void keyReleased(KeyEvent evt){
  260. if (evt.getKeyChar() == 'w'){
  261. thepanel.GhostUp = false;
  262. } else if (evt.getKeyChar() == 'a'){
  263. thepanel.GhostLeft = false;
  264. } else if (evt.getKeyChar() == 's'){
  265. thepanel.GhostDown = false;
  266. } else if (evt.getKeyChar() == 'd'){
  267. thepanel.GhostRight = false;
  268. }
  269. }
  270. public void keyPressed(KeyEvent evt){
  271. if (evt.getKeyChar() == 'w'){
  272. thepanel.GhostUp = true;
  273. } else if (evt.getKeyChar() == 'a'){
  274. thepanel.GhostLeft = true;
  275. } else if (evt.getKeyChar() == 's'){
  276. thepanel.GhostDown = true;
  277. } else if (evt.getKeyChar() == 'd'){
  278. thepanel.GhostRight = true;
  279. }
  280. }
  281. public void keyTyped(KeyEvent evt){
  282.  
  283. }
  284.  
  285. public cptserver(){
  286. ssm = new SuperSocketMaster(1337,this);
  287. theframe = new JFrame("CPT SERVER CHANGE THIS LATER");
  288. theframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  289.  
  290. thepanel = new JAnimation();
  291. thepanel.setLayout(null);
  292. thepanel.setPreferredSize(new Dimension(1280,720));
  293. theframe.addKeyListener(this);
  294. thepanel.addMouseListener(this);
  295. theframe.setContentPane(thepanel);
  296. theframe.pack();
  297. theframe.setVisible(true);
  298. thetimer = new Timer(1000/60, this);
  299. thetimer.start();
  300. }
  301.  
  302. public static void main (String[] args){
  303. cptserver server = new cptserver();
  304. server.ssm.connect();
  305. server.thepanel.IsServer = true;
  306. }
  307.  
  308. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement