diff --git a/game.js b/game.js index b825de5..814983c 100644 --- a/game.js +++ b/game.js @@ -1,9 +1,26 @@ const uuid = require('node-uuid'); +const players = {}; + const Game = function() { this.id = uuid.v4(); } +Game.prototype.addPlayer = function(id, name) { + if (!players[id]) { + players[id] = name; + } +} + +Game.prototype.removePlayer = function(id) { + players[id] = undefined; + delete players[id]; +} + +Game.prototype.getPlayers = function() { + return players; +} + Game.prototype.getRobots = function() { const robots = [ {x: 3, y: 1, color: 'red' }, diff --git a/ricochet.css b/ricochet.css new file mode 100644 index 0000000..70f7cf7 --- /dev/null +++ b/ricochet.css @@ -0,0 +1,111 @@ +* { + box-sizing: border-box; + font-family: Montserrat; +} + +.controls-container { + background: #e7e7e7; + bottom: 0; + left: 0; + position: absolute; + top: 0; + width: 300px; +} + +.controls-subtitle { + background-color: #555; + color: #fff; +} + +.controls-title { + background-color: #222; + background-image: url('sprite-robots.png'); + color: #fff; + font-size: 12px; + line-height: 48px; + text-align: center; +} + +.controls-room { + line-height: 48px; + text-align: center; +} + +.controls-room span { + +} + +.controls-room input { + +} + +.controls-room button { + +} + +.board-container { + background: conic-gradient(lime 0 25%, yellow 25% 50%, red 50% 75%, blue 75% 100%); + bottom: 0; + left: 300px; + position: absolute; + right: 0; + top: 0; +} + +#board { + border-color: #aaa; + border-style: solid; + border-width: 1px 0 0 1px; + margin: 0 auto; + position: relative; +} + +.board-wall-x { + background: #222; + height: 8px; + margin-top: -4px; + position: absolute; + width: 40px; +} + +.board-wall-y { + background: #222; + height: 40px; + margin-left: -4px; + position: absolute; + width: 8px; +} + +.board-robot { + border-radius: 18px; + height: 36px; + margin: 2px; + position: absolute; + width: 36px; +} + +.square{ + background: #ddd; + border-style: solid; + border-color: #aaa; + border-width: 0 1px 1px 0; + float: left; + height: 40px; + width: 40px; +} + +.moves { + background: salmon; +} + +.move-count { + background: yellow; + border-radius: 8px; + float: left; + font-size: 12px; + height: 16px; + line-height: 16px; + margin: 4px; + text-align: center; + width: 16px; +} \ No newline at end of file diff --git a/ricochet.html b/ricochet.html index af3ac3a..cd0e90a 100644 --- a/ricochet.html +++ b/ricochet.html @@ -4,108 +4,26 @@