Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //NintendoLand Luigi's Ghost Mansion (Ghost Player) aka main SERVER
- //Keane Tan
- //Mr. Cadawas
- //Version Alpha v0.0.1
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import javax.swing.event.*;
- public class cptserver implements ActionListener, KeyListener, MouseListener, MouseMotionListener {
- //GUI Main Properties
- JFrame theframe;
- JAnimation thepanel;
- Timer thetimer;
- SuperSocketMaster ssm;
- //Game Variable Properties
- int intPlayerCount = 1;
- //Main String Array for splitting nettexts
- //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
- String strNetText[] = new String[20];
- //Methods
- public void actionPerformed(ActionEvent evt){
- if (evt.getSource() == thetimer){
- int GhostX = thepanel.GhostX;
- int GhostY = thepanel.GhostY;
- int P1X = thepanel.P1X;
- int P1Y = thepanel.P1Y;
- int P2X = thepanel.P2X;
- int P2Y = thepanel.P2Y;
- int P3X = thepanel.P3X;
- int P3Y = thepanel.P3Y;
- int P4X = thepanel.P4X;
- int P4Y = thepanel.P4Y;
- ssm.sendText(" , ,GhostMove,"+GhostX+","+GhostY+",P1Move, ,"+P1X+","+P1Y+",P2Move, ,"+P2X+","+P2Y+",P3Move, ,"+P3X+","+P3Y+",P4Move, ,"+P4X+","+P4Y);
- thepanel.repaint();
- //System.out.println (ssm.readText());
- }
- if (evt.getSource() == ssm){
- String strNetText[] = ssm.readText().split(",");
- //Write all code for super socket master SERVER below!!
- if (strNetText[0].equalsIgnoreCase("connect")){
- if (intPlayerCount == 1){
- 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);
- intPlayerCount++;
- } else if (intPlayerCount == 2){
- 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);
- intPlayerCount++;
- } else if (intPlayerCount == 3){
- 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);
- intPlayerCount++;
- } else if (intPlayerCount == 4){
- 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);
- intPlayerCount++;
- }
- thepanel.intPlayerCount = intPlayerCount - 1;
- }
- //Moving for Players and code for flashlight
- //PLAYER 1----------------------------------------------------------
- if (strNetText[6].equalsIgnoreCase("up")){
- thepanel.P1Up = true;
- } else if (strNetText[6].equalsIgnoreCase("down")){
- thepanel.P1Down = true;
- } else if (strNetText[6].equalsIgnoreCase("left")){
- thepanel.P1Left = true;
- } else if (strNetText[6].equalsIgnoreCase("right")){
- thepanel.P1Right = true;
- } else if (strNetText[6].equalsIgnoreCase("upfalse")){
- thepanel.P1Up = false;
- } else if (strNetText[6].equalsIgnoreCase("downfalse")){
- thepanel.P1Down = false;
- } else if (strNetText[6].equalsIgnoreCase("leftfalse")){
- thepanel.P1Left = false;
- } else if (strNetText[6].equalsIgnoreCase("rightfalse")){
- thepanel.P1Right = false;
- } else if (strNetText[6].equalsIgnoreCase("uplighton")){
- thepanel.P1FlashlightUp = true;
- 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);
- } else if (strNetText[6].equalsIgnoreCase("leftlighton")){
- thepanel.P1FlashlightLeft = true;
- 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);
- } else if (strNetText[6].equalsIgnoreCase("downlighton")){
- thepanel.P1FlashlightDown = true;
- 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);
- } else if (strNetText[6].equalsIgnoreCase("rightlighton")){
- thepanel.P1FlashlightRight = true;
- 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);
- } else if (strNetText[6].equalsIgnoreCase("uplightoff")){
- thepanel.P1FlashlightUp = false;
- 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);
- } else if (strNetText[6].equalsIgnoreCase("leftlightoff")){
- thepanel.P1FlashlightLeft = false;
- 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);
- } else if (strNetText[6].equalsIgnoreCase("downlightoff")){
- thepanel.P1FlashlightDown = false;
- 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);
- } else if (strNetText[6].equalsIgnoreCase("rightlightoff")){
- thepanel.P1FlashlightRight = false;
- 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);
- }
- //PLAYER 2----------------------------------------------------------
- if (strNetText[10].equalsIgnoreCase("up")){
- thepanel.P2Up = true;
- } else if (strNetText[10].equalsIgnoreCase("down")){
- thepanel.P2Down = true;
- } else if (strNetText[10].equalsIgnoreCase("left")){
- thepanel.P2Left = true;
- } else if (strNetText[10].equalsIgnoreCase("right")){
- thepanel.P2Right = true;
- } else if (strNetText[10].equalsIgnoreCase("upfalse")){
- thepanel.P2Up = false;
- } else if (strNetText[10].equalsIgnoreCase("downfalse")){
- thepanel.P2Down = false;
- } else if (strNetText[10].equalsIgnoreCase("leftfalse")){
- thepanel.P2Left = false;
- } else if (strNetText[10].equalsIgnoreCase("rightfalse")){
- thepanel.P2Right = false;
- } else if (strNetText[10].equalsIgnoreCase("uplighton")){
- thepanel.P2FlashlightUp = true;
- 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);
- } else if (strNetText[10].equalsIgnoreCase("leftlighton")){
- thepanel.P2FlashlightLeft = true;
- 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);
- } else if (strNetText[10].equalsIgnoreCase("downlighton")){
- thepanel.P2FlashlightDown = true;
- 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);
- } else if (strNetText[10].equalsIgnoreCase("rightlighton")){
- thepanel.P2FlashlightRight = true;
- 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);
- } else if (strNetText[10].equalsIgnoreCase("uplightoff")){
- thepanel.P2FlashlightUp = false;
- 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);
- } else if (strNetText[10].equalsIgnoreCase("leftlightoff")){
- thepanel.P2FlashlightLeft = false;
- 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);
- } else if (strNetText[10].equalsIgnoreCase("downlightoff")){
- thepanel.P2FlashlightDown = false;
- 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);
- } else if (strNetText[10].equalsIgnoreCase("rightlightoff")){
- thepanel.P2FlashlightRight = false;
- 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);
- }
- //PLAYER 3-------------------------------------------------------
- if (strNetText[14].equalsIgnoreCase("up")){
- thepanel.P3Up = true;
- } else if (strNetText[14].equalsIgnoreCase("down")){
- thepanel.P3Down = true;
- } else if (strNetText[14].equalsIgnoreCase("left")){
- thepanel.P3Left = true;
- } else if (strNetText[14].equalsIgnoreCase("right")){
- thepanel.P3Right = true;
- } else if (strNetText[14].equalsIgnoreCase("upfalse")){
- thepanel.P3Up = false;
- } else if (strNetText[14].equalsIgnoreCase("downfalse")){
- thepanel.P3Down = false;
- } else if (strNetText[14].equalsIgnoreCase("leftfalse")){
- thepanel.P3Left = false;
- } else if (strNetText[14].equalsIgnoreCase("rightfalse")){
- thepanel.P3Right = false;
- } else if (strNetText[14].equalsIgnoreCase("uplighton")){
- thepanel.P3FlashlightUp = true;
- 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);
- } else if (strNetText[14].equalsIgnoreCase("leftlighton")){
- thepanel.P3FlashlightLeft = true;
- 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);
- } else if (strNetText[14].equalsIgnoreCase("downlighton")){
- thepanel.P3FlashlightDown = true;
- 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);
- } else if (strNetText[14].equalsIgnoreCase("rightlighton")){
- thepanel.P3FlashlightRight = true;
- 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);
- } else if (strNetText[14].equalsIgnoreCase("uplightoff")){
- thepanel.P3FlashlightUp = false;
- 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);
- } else if (strNetText[14].equalsIgnoreCase("leftlightoff")){
- thepanel.P3FlashlightLeft = false;
- 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);
- } else if (strNetText[14].equalsIgnoreCase("downlightoff")){
- thepanel.P3FlashlightDown = false;
- 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);
- } else if (strNetText[14].equalsIgnoreCase("rightlightoff")){
- thepanel.P3FlashlightRight = false;
- } 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);
- //PLAYER 4--------------------------------------------------------
- if (strNetText[18].equalsIgnoreCase("up")){
- thepanel.P4Up = true;
- } else if (strNetText[18].equalsIgnoreCase("down")){
- thepanel.P4Down = true;
- } else if (strNetText[18].equalsIgnoreCase("left")){
- thepanel.P4Left = true;
- } else if (strNetText[18].equalsIgnoreCase("right")){
- thepanel.P4Right = true;
- } else if (strNetText[18].equalsIgnoreCase("upfalse")){
- thepanel.P4Up = false;
- } else if (strNetText[18].equalsIgnoreCase("downfalse")){
- thepanel.P4Down = false;
- } else if (strNetText[18].equalsIgnoreCase("leftfalse")){
- thepanel.P4Left = false;
- } else if (strNetText[18].equalsIgnoreCase("rightfalse")){
- thepanel.P4Right = false;
- } else if (strNetText[18].equalsIgnoreCase("uplighton")){
- thepanel.P2FlashlightUp = true;
- 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);
- } else if (strNetText[18].equalsIgnoreCase("leftlighton")){
- thepanel.P2FlashlightLeft = true;
- 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);
- } else if (strNetText[18].equalsIgnoreCase("downlighton")){
- thepanel.P2FlashlightDown = true;
- 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);
- } else if (strNetText[18].equalsIgnoreCase("rightlighton")){
- thepanel.P2FlashlightRight = true;
- 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);
- } else if (strNetText[18].equalsIgnoreCase("uplightoff")){
- thepanel.P2FlashlightUp = false;
- 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);
- } else if (strNetText[18].equalsIgnoreCase("leftlightoff")){
- thepanel.P2FlashlightLeft = false;
- 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);
- } else if (strNetText[18].equalsIgnoreCase("downlightoff")){
- thepanel.P2FlashlightDown = false;
- 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);
- } else if (strNetText[18].equalsIgnoreCase("rightlightoff")){
- thepanel.P2FlashlightRight = false;
- 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);
- }
- }
- }
- public void mouseExited(MouseEvent evt){
- }
- public void mouseEntered(MouseEvent evt){
- }
- public void mouseReleased(MouseEvent evt){
- }
- public void mousePressed(MouseEvent evt){
- }
- public void mouseClicked(MouseEvent evt){
- }
- public void mouseMoved(MouseEvent evt){
- }
- public void mouseDragged(MouseEvent evt){
- }
- public void keyReleased(KeyEvent evt){
- if (evt.getKeyChar() == 'w'){
- thepanel.GhostUp = false;
- } else if (evt.getKeyChar() == 'a'){
- thepanel.GhostLeft = false;
- } else if (evt.getKeyChar() == 's'){
- thepanel.GhostDown = false;
- } else if (evt.getKeyChar() == 'd'){
- thepanel.GhostRight = false;
- }
- }
- public void keyPressed(KeyEvent evt){
- if (evt.getKeyChar() == 'w'){
- thepanel.GhostUp = true;
- } else if (evt.getKeyChar() == 'a'){
- thepanel.GhostLeft = true;
- } else if (evt.getKeyChar() == 's'){
- thepanel.GhostDown = true;
- } else if (evt.getKeyChar() == 'd'){
- thepanel.GhostRight = true;
- }
- }
- public void keyTyped(KeyEvent evt){
- }
- public cptserver(){
- ssm = new SuperSocketMaster(1337,this);
- theframe = new JFrame("CPT SERVER CHANGE THIS LATER");
- theframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- thepanel = new JAnimation();
- thepanel.setLayout(null);
- thepanel.setPreferredSize(new Dimension(1280,720));
- theframe.addKeyListener(this);
- thepanel.addMouseListener(this);
- theframe.setContentPane(thepanel);
- theframe.pack();
- theframe.setVisible(true);
- thetimer = new Timer(1000/60, this);
- thetimer.start();
- }
- public static void main (String[] args){
- cptserver server = new cptserver();
- server.ssm.connect();
- server.thepanel.IsServer = true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement