]> git.eli173.com Git - pong_br/commitdiff
prepping for prod, small fixes
authorElijah Cohen <eli@eli173.com>
Fri, 17 May 2019 02:24:54 +0000 (21:24 -0500)
committerElijah Cohen <eli@eli173.com>
Fri, 17 May 2019 02:24:54 +0000 (21:24 -0500)
.gitignore
server/constants.js
web/draw.js
web/index.html
web/main.js
web/play.html
web/play/index.html [new file with mode: 0644]

index 825372ed76dfe7872f70d59973a7f8a38cd9c6e7..f420abc2a18b2b0bd704cff4bf09ff380e791a17 100644 (file)
@@ -42,3 +42,4 @@ server/node_modules/*
 /server/robot.js~
 /server/TODO.org~
 /server/Dockerfile~
+/web/play/index.html~
index 4a6be0ffc7ad115937a59dfdd77050c4ae578150..733eb02e7185b6214607d29ecda91b0ea0fcc394 100644 (file)
@@ -2,7 +2,7 @@
 
 var c = {
     // matchmaker
-    WS_PORT: 443,
+    WS_PORT: 6789,
     NUM_PLAYERS: 10,
     FPS: 30,
     WAIT_TIME: 60000, // 1 minute
index 30cc82521244c8fc0557ace4ce12084069060fd9..5566443111d15d9f9a0f8acbb8f26e78f8e6ea43 100644 (file)
@@ -53,7 +53,10 @@ var draw = function(state, ctx) {
        if(paddle === undefined) alert("UH OH, paddle somehow undefined");
        // cool this is way simpler since we know these are all alive
        var pps = getPaddlePoints(paddle, eps);
-       drawLine(ctx, pcolor, pps.f, pps.s);
+       if(paddle.id == state.id)
+           drawLine(ctx, playercolor, pps.f, pps.s);
+       else
+           drawLine(ctx, pcolor, pps.f, pps.s);
     }
     if(isDead) {
        drawOverlay(ctx, state.dead.find(d => d.id == state.id).place);
index 9dfb7f01ff6dfcac138bb811b0a98e26f200915e..de949b8f2a19e69dff2416cda57418b8010ad2fb 100644 (file)
   <body>
     <div id="content">
       <p id="name">Pong: Battle Royale!</p>
-      <p>Yes, this is a battle royale version of pong. You are matched up with a large amount of other players in a shrinking arena, and your goal is to survive to the very end. Use 'w' and 's', 'k' and 'j', or the arrow keys to move your paddle with the keyboard, or touch the top or bottom half of the screen to move up or down with a touchscreen.</p>
-      <a href="play.html" id="b">PLAY</a>
+      <p>Yes, this is a battle royale version of pong. You are matched up with a large amount of other players in a shrinking arena, and your goal is to survive to the very end.</p>
+      <p>Use 'w' and 's', 'k' and 'j', or the arrow keys to move your paddle with the keyboard, or touch the top or bottom half of the screen to move up or down with a touchscreen.</p>
+      <p>You are the player on the left-hand side whose paddle is a slightly different color.</p>
+      <a href="/play" id="b">PLAY</a>
     </div>
   </body>
 </html>
index 91ee36997d0b6443510505607b0693c1ba32194e..f2063d55a4faf4b19b4d683e6089fd11837c454f 100644 (file)
@@ -1,5 +1,5 @@
 
-const prefixurl = "wss://" + window.location.hostname + ":" + c.WS_PORT;
+const prefixurl = "ws://" + window.location.hostname + ":" + c.WS_PORT;
 
 var theSocket = null;
 
index 4ffbef1b58b0ebb3749a3907499b2b03fe3da190..49c6fa4255fe38745affa72adde0800eab9f228b 100644 (file)
@@ -3,13 +3,13 @@
 <html>
   <head>
     <title>Pong Battle Royale</title>
-    <script type="text/javascript" src="constants.js"></script>
-    <script type="text/javascript" src="coord.js"></script>
-    <script type="text/javascript" src="draw.js"></script>
-    <script type="text/javascript" src="main.js"></script>
-    <script type="text/javascript" src="field.js"></script>
-    <script type="text/javascript" src="endpoints.js"></script>
-    <script type="text/javascript" src="input.js"></script>
+    <script type="text/javascript" src="/constants.js"></script>
+    <script type="text/javascript" src="/coord.js"></script>
+    <script type="text/javascript" src="/draw.js"></script>
+    <script type="text/javascript" src="/main.js"></script>
+    <script type="text/javascript" src="/field.js"></script>
+    <script type="text/javascript" src="/endpoints.js"></script>
+    <script type="text/javascript" src="/input.js"></script>
     <style type="text/css">
       body { background-color: blue; }
       #c {
diff --git a/web/play/index.html b/web/play/index.html
new file mode 100644 (file)
index 0000000..49c6fa4
--- /dev/null
@@ -0,0 +1,26 @@
+<!doctype html>
+<meta charset='utf-8'>
+<html>
+  <head>
+    <title>Pong Battle Royale</title>
+    <script type="text/javascript" src="/constants.js"></script>
+    <script type="text/javascript" src="/coord.js"></script>
+    <script type="text/javascript" src="/draw.js"></script>
+    <script type="text/javascript" src="/main.js"></script>
+    <script type="text/javascript" src="/field.js"></script>
+    <script type="text/javascript" src="/endpoints.js"></script>
+    <script type="text/javascript" src="/input.js"></script>
+    <style type="text/css">
+      body { background-color: blue; }
+      #c {
+         width: 100%;
+         height: 100%;
+         border: 1px solid red;
+         background-color: black;
+      }
+    </style>
+  </head>
+  <body>
+    <canvas id="c">Sorry, you need to have Javascript enabled for this!</canvas>
+  </body>
+</html>