a few oopsies
This commit is contained in:
parent
8160fed639
commit
5bd7b5ab0d
@ -132,6 +132,7 @@
|
||||
let column = GameDrawer.gridX - 1
|
||||
if (GameDrawer.possible(column)) {
|
||||
io.emit('place_at', {column: column, gameId: Connect4.Game.gameId})
|
||||
Connect4.Game.myTurn = false
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "battleship.js",
|
||||
"name": "connect_four.js",
|
||||
"version": "0.0.0",
|
||||
"description": "Battleship game in the browser",
|
||||
"description": "Connect Four game in the browser",
|
||||
"main": "server.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [
|
||||
"battleship",
|
||||
"connectfour",
|
||||
"game",
|
||||
"html5"
|
||||
],
|
||||
|
@ -236,7 +236,6 @@ function detectWin (color, game) {
|
||||
for (let i = 0; i < 4; i++) {
|
||||
let pAt = getPiece(game, parseInt(c) + i, piece.y)
|
||||
if (pAt && pAt.color === color) {
|
||||
console.log(pAt)
|
||||
matches += 1
|
||||
} else {
|
||||
matches = 0
|
||||
@ -423,7 +422,9 @@ io.on('connection', (socket) => {
|
||||
clients[opponent].socket.emit('place', {column: data.column, color: playerInGame})
|
||||
|
||||
game.places[data.column].push({color: playerInGame, y: 8 - game.places[data.column].length})
|
||||
console.log(game.places[data.column])
|
||||
|
||||
clients[me].socket.emit('turn', false)
|
||||
clients[opponent].socket.emit('turn', true)
|
||||
|
||||
if (detectWin(playerInGame, game)) {
|
||||
endGame(data.gameId, me, opponent, 1)
|
||||
@ -434,9 +435,6 @@ io.on('connection', (socket) => {
|
||||
endGame(data.gameId, me, opponent, 2)
|
||||
return
|
||||
}
|
||||
|
||||
clients[me].socket.emit('turn', false)
|
||||
clients[opponent].socket.emit('turn', true)
|
||||
})
|
||||
|
||||
socket.on('disconnect', () => {
|
||||
|
Loading…
Reference in New Issue
Block a user