From 87a0508b6ca465c72569ca9f6a8208cb4f3537b2 Mon Sep 17 00:00:00 2001 From: Elijah Cohen Date: Thu, 16 May 2019 21:24:54 -0500 Subject: [PATCH] prepping for prod, small fixes --- .gitignore | 1 + server/constants.js | 2 +- web/draw.js | 5 ++++- web/index.html | 6 ++++-- web/main.js | 2 +- web/play.html | 14 +++++++------- web/play/index.html | 26 ++++++++++++++++++++++++++ 7 files changed, 44 insertions(+), 12 deletions(-) create mode 100644 web/play/index.html diff --git a/.gitignore b/.gitignore index 825372e..f420abc 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,4 @@ server/node_modules/* /server/robot.js~ /server/TODO.org~ /server/Dockerfile~ +/web/play/index.html~ diff --git a/server/constants.js b/server/constants.js index 4a6be0f..733eb02 100644 --- a/server/constants.js +++ b/server/constants.js @@ -2,7 +2,7 @@ var c = { // matchmaker - WS_PORT: 443, + WS_PORT: 6789, NUM_PLAYERS: 10, FPS: 30, WAIT_TIME: 60000, // 1 minute diff --git a/web/draw.js b/web/draw.js index 30cc825..5566443 100644 --- a/web/draw.js +++ b/web/draw.js @@ -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); diff --git a/web/index.html b/web/index.html index 9dfb7f0..de949b8 100644 --- a/web/index.html +++ b/web/index.html @@ -25,8 +25,10 @@

Pong: Battle Royale!

-

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.

- PLAY +

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.

+

You are the player on the left-hand side whose paddle is a slightly different color.

+ PLAY
diff --git a/web/main.js b/web/main.js index 91ee369..f2063d5 100644 --- a/web/main.js +++ b/web/main.js @@ -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; diff --git a/web/play.html b/web/play.html index 4ffbef1..49c6fa4 100644 --- a/web/play.html +++ b/web/play.html @@ -3,13 +3,13 @@ Pong Battle Royale - - - - - - - + + + + + + + + + + Sorry, you need to have Javascript enabled for this! + + -- 2.39.2