Permalink
Browse files

started lobby feature (unstable)

  • Loading branch information...
1 parent 5906fb0 commit 66992ee34b55159b7af18314d2f22bb6746b78e0 @Fabryz committed Mar 3, 2013
Showing with 67 additions and 6 deletions.
  1. +21 −3 TODO
  2. +23 −1 public/css/style.css
  3. +5 −2 public/index.html
  4. +18 −0 public/js/Mangonel.js
View
24 TODO
@@ -6,8 +6,26 @@
- posizione rispetto ad altri
--> checkWavesBounds
+- checkWavesBounds for complete grid
+- 2nd canvas buffer
-last_wave_id start 0 / 1 -> array filter null
+- all players must be ready to start
+- server side waves data structure management
+- wave can echo till the opposite side of grid
-- 2nd canvas buffer
+1 | 2 | 3
+----------
+4 | 5 | 6
+----------
+7 | 8 | 9
+
+- swappable position http://james2doyle.github.com/zepto-dragswap/
+- can't swap to isolated position
+
+- make a damn init function
+- updateLobby(); only if visible
+
+- game statuses
+- generate canvas only after lobby, don't keep it hidden from start
+
+-> players / player bug
View
@@ -22,7 +22,6 @@ a {
h1 {
color: #3CAEC2;
- display: none;
}
#debug {
@@ -51,6 +50,29 @@ h1 {
top: 0;
left: 0;
background-color: #CCC;
+ display: none;
+}
+#lobby {
+ position: absolute;
+ top: 0;
+ left: 0;
+}
+
+#lobby ul#players {
+ margin: 20px auto 0;
+ width: 318px;
+ height: 318px;
+}
+
+#lobby ul#players li{
+ background-color: #D3D3D3;
+ float: left;
+ width: 100px;
+ height: 100px;
+ border: 3px solid gray;
+ -webkit-border-radius: 5px;
+ -moz-border-radius: 5px;
+ border-radius: 5px;
}
#scoreboard {
View
@@ -3,14 +3,17 @@
<head>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
- <title>Mangonel</title>
+ <title>Mobile Resonance</title>
<link type="text/css" rel="stylesheet" href="./css/style.css" media="screen">
</head>
<body>
<div id="wrapper">
- <h1>Mangonel</h1>
+ <div id="lobby">
+ <h1>Mobile Resonance</h1>
+ <ul id="players"></ul>
+ </div>
<canvas id="canvas" width="512" height="512">
<p>Looks like your browser does NOT support HTML5 Canvas.</p>
<p>Please <a href="http://www.google.com/chrome" title="Download Google Chrome">get a decent one</a>.</p>
View
@@ -57,12 +57,25 @@
socket = new io.connect(window.location.href);
var canvas = $('#canvas'),
+ lobby = $('#lobby'),
ctx = canvas.get(0).getContext("2d"),
canvasWidth = canvas.width(),
canvasHeight = canvas.height();
var vp = new Viewport(canvasWidth, canvasHeight);
+ var updateLobby = function() {
+ lobby.attr({ width: $(window).innerWidth(), height: $(window).innerHeight() });
+ var list = lobby.find('ul#players'),
+ i = 0;
+
+ list.html('');
+ list.append("<li>"+ player.id +"</li>");
+ for (i in players) {
+ list.append("<li>"+ players[i].id +"</li>");
+ }
+ };
+
var resizeCanvas = function() {
canvasWidth = $(window).innerWidth();
canvasHeight = $(window).innerHeight();
@@ -393,6 +406,8 @@
debugLog('You have joined the server.');
// waves = waves.filter(function(){return true;}); // cleans null from array FIXME
+
+ updateLobby();
});
socket.on('quit', function(data) {
@@ -408,6 +423,7 @@
}
debugLog('Player quitted: '+ quitter +' (id '+ data.id +')');
+ updateLobby();
});
socket.on('newplayer', function(data) {
@@ -421,6 +437,8 @@
players.push(newPlayer);
debugLog('New player joined: '+ newPlayer.nick);
tmpPlayer = {};
+
+ updateLobby();
});
socket.on('playerlist', function(data) {

0 comments on commit 66992ee

Please sign in to comment.