mirror of
https://github.com/gwenhael-le-moine/c-urs_-toil-s.git
synced 2024-12-26 09:58:48 +01:00
add info panel displaying game's state
This commit is contained in:
parent
5a24e218d1
commit
e939026242
3 changed files with 10 additions and 4 deletions
|
@ -8,4 +8,4 @@
|
|||
.gstar #blackboard .cube_selected{background-image:url(../themes/HP48/tex_cube_selected.png);color:red}
|
||||
.gstar #blackboard .gift{background-image:url(../themes/HP48/tex_gift.png);color:yellow}
|
||||
.gstar #blackboard .void{background-image:url(../themes/HP48/tex_empty.png);}
|
||||
|
||||
.gstar aside{float:left;height:140px;padding:20px;background:#ddd}
|
||||
|
|
|
@ -24,14 +24,12 @@
|
|||
<body>
|
||||
<div id="container">
|
||||
<header>
|
||||
Star5
|
||||
</header>
|
||||
|
||||
<div id="main" role="main">
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
©Gwh
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -128,6 +128,14 @@ function format_level( state, text ) {
|
|||
return myReplacer( state.board );
|
||||
}
|
||||
|
||||
function format_infos( state ) {
|
||||
var infos = "<h1>Star5</h1><br />";
|
||||
infos += "Level " + (state.level+1) + " of " + levels.length + "<br />";
|
||||
infos += count_gifts( state ) + " gifts left<br />";
|
||||
infos += state.distance_travelled + " meters travelled";
|
||||
return infos;
|
||||
}
|
||||
|
||||
function load_level( levelset, nb ) {
|
||||
state.level = nb;
|
||||
state.board = levelset[ state.level ];
|
||||
|
@ -137,7 +145,7 @@ function load_level( levelset, nb ) {
|
|||
}
|
||||
|
||||
function display_level( state, elt ) {
|
||||
var starhtml = '<div class="gstar"><p id="blackboard">' + format_level( state, false ) + '</p></div>';
|
||||
var starhtml = '<div class="gstar"><div id="blackboard">' + format_level( state, false ) + '</div><aside id="infos">' + format_infos( state ) + '</aside></div>';
|
||||
$( elt ).html( starhtml );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue