Merge branch 'master' of https://github.com/cycojesus/c-urs_-toil-s
11
star.js/css/star.css
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
.gstar{float:left;width:100%}
|
||||||
|
.gstar #blackboard{width:320px;height:180px;background:#333;float:left}
|
||||||
|
.gstar #blackboard .starcell{width:20px;height:20px;display:block;float:left;text-align:center}
|
||||||
|
.gstar #blackboard .wall{background-image:url(../themes/HP48/tex_wall.png);color:#000}
|
||||||
|
.gstar #blackboard .ball{background-image:url(../themes/HP48/tex_ball.png);color:#99f}
|
||||||
|
.gstar #blackboard .cube{background-image:url(../themes/HP48/tex_cube.png);color:red}
|
||||||
|
.gstar #blackboard .ball_selected{background-image:url(../themes/HP48/tex_ball_selected.png);color:#99f}
|
||||||
|
.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;width:120px;padding:20px;background:#ddd}
|
|
@ -17,32 +17,19 @@
|
||||||
<link rel="shortcut icon" href="/favicon.ico">
|
<link rel="shortcut icon" href="/favicon.ico">
|
||||||
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
|
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
|
||||||
<link rel="stylesheet" href="css/style.css?v=2">
|
<link rel="stylesheet" href="css/style.css?v=2">
|
||||||
|
<link rel="stylesheet" href="css/star.css">
|
||||||
|
|
||||||
<script src="js/libs/modernizr-1.7.min.js"></script>
|
<script src="js/libs/modernizr-1.7.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="container">
|
<div id="container">
|
||||||
<header>
|
<header>
|
||||||
Star5
|
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div id="main" role="main">
|
<div id="main" role="main">
|
||||||
<style>
|
|
||||||
#blackboard{width:16em;background:#333;float:left}
|
|
||||||
.starcell{width:1em;height:1em;display:block;float:left;text-align:center}
|
|
||||||
.selected{font-weight:bold}
|
|
||||||
.wall{color:#000}
|
|
||||||
.ball{color:#99f}
|
|
||||||
.cube{color:red}
|
|
||||||
.gift{color:yellow}
|
|
||||||
.void{}
|
|
||||||
.selected{background:#555}
|
|
||||||
</style>
|
|
||||||
<p id="blackboard"></p>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
©Gwh
|
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -60,7 +47,7 @@
|
||||||
<script src="js/star.js"></script>
|
<script src="js/star.js"></script>
|
||||||
<script>
|
<script>
|
||||||
state = load_level( levels, 0 );
|
state = load_level( levels, 0 );
|
||||||
start_loop( state, "#blackboard" );
|
start_loop( state, "#main" );
|
||||||
$( document ).focus();
|
$( document ).focus();
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -26,7 +26,7 @@ var options = {
|
||||||
};
|
};
|
||||||
var state = {
|
var state = {
|
||||||
moving : cell.BALL,
|
moving : cell.BALL,
|
||||||
distance_travelled : 0,
|
distance_travelled : 0,
|
||||||
level : 0,
|
level : 0,
|
||||||
board : ""
|
board : ""
|
||||||
};
|
};
|
||||||
|
@ -95,7 +95,7 @@ function won_or_not( state ) {
|
||||||
return count_gifts( state ) === 0;
|
return count_gifts( state ) === 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function format_level( state ) {
|
function format_level( state, text ) {
|
||||||
function Replacer( conversionObject ) {
|
function Replacer( conversionObject ) {
|
||||||
|
|
||||||
var regexpStr = '';
|
var regexpStr = '';
|
||||||
|
@ -118,11 +118,24 @@ function format_level( state ) {
|
||||||
'H': '<span class="starcell cube">H</span>',
|
'H': '<span class="starcell cube">H</span>',
|
||||||
'@': '<span class="starcell ball">@</span>'
|
'@': '<span class="starcell ball">@</span>'
|
||||||
};
|
};
|
||||||
substitutions[ state.moving ] = substitutions[ state.moving ].replace( '">', ' selected">' );
|
substitutions[ state.moving ] = substitutions[ state.moving ].replace( '">', '_selected">' );
|
||||||
|
if ( text == false ) {
|
||||||
|
for ( var c in substitutions ) {
|
||||||
|
substitutions[ c ] = substitutions[ c ].replace( />.</, '><' );
|
||||||
|
}
|
||||||
|
}
|
||||||
var myReplacer = Replacer( substitutions );
|
var myReplacer = Replacer( substitutions );
|
||||||
return myReplacer( state.board );
|
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 ) {
|
function load_level( levelset, nb ) {
|
||||||
state.level = nb;
|
state.level = nb;
|
||||||
state.board = levelset[ state.level ];
|
state.board = levelset[ state.level ];
|
||||||
|
@ -132,7 +145,8 @@ function load_level( levelset, nb ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function display_level( state, elt ) {
|
function display_level( state, elt ) {
|
||||||
$( elt ).html( format_level( state ) );
|
var starhtml = '<div class="gstar"><div id="blackboard">' + format_level( state, false ) + '</div><aside id="infos">' + format_infos( state ) + '</aside></div>';
|
||||||
|
$( elt ).html( starhtml );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
BIN
star.js/themes/HP48/tex_ball.png
Normal file
After Width: | Height: | Size: 226 B |
BIN
star.js/themes/HP48/tex_ball_selected.png
Normal file
After Width: | Height: | Size: 278 B |
BIN
star.js/themes/HP48/tex_cube.png
Normal file
After Width: | Height: | Size: 183 B |
BIN
star.js/themes/HP48/tex_cube_selected.png
Normal file
After Width: | Height: | Size: 201 B |
BIN
star.js/themes/HP48/tex_empty.png
Normal file
After Width: | Height: | Size: 168 B |
BIN
star.js/themes/HP48/tex_gift.png
Normal file
After Width: | Height: | Size: 209 B |
BIN
star.js/themes/HP48/tex_wall.png
Normal file
After Width: | Height: | Size: 246 B |
BIN
star.js/themes/cyco001/tex_ball.png
Normal file
After Width: | Height: | Size: 378 B |
BIN
star.js/themes/cyco001/tex_ball_selected.png
Normal file
After Width: | Height: | Size: 598 B |
BIN
star.js/themes/cyco001/tex_cube.png
Normal file
After Width: | Height: | Size: 173 B |
BIN
star.js/themes/cyco001/tex_cube_selected.png
Normal file
After Width: | Height: | Size: 221 B |
BIN
star.js/themes/cyco001/tex_empty.png
Normal file
After Width: | Height: | Size: 146 B |
BIN
star.js/themes/cyco001/tex_gift.png
Normal file
After Width: | Height: | Size: 619 B |
BIN
star.js/themes/cyco001/tex_wall.png
Normal file
After Width: | Height: | Size: 732 B |
BIN
star.js/themes/cyco002/tex_ball.png
Normal file
After Width: | Height: | Size: 749 B |
BIN
star.js/themes/cyco002/tex_ball_selected.png
Normal file
After Width: | Height: | Size: 945 B |
BIN
star.js/themes/cyco002/tex_cube.png
Normal file
After Width: | Height: | Size: 406 B |
BIN
star.js/themes/cyco002/tex_cube_selected.png
Normal file
After Width: | Height: | Size: 559 B |
BIN
star.js/themes/cyco002/tex_empty.png
Normal file
After Width: | Height: | Size: 115 B |
BIN
star.js/themes/cyco002/tex_gift.png
Normal file
After Width: | Height: | Size: 642 B |
BIN
star.js/themes/cyco002/tex_wall.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
star.js/themes/inversed/tex_ball.png
Normal file
After Width: | Height: | Size: 350 B |
BIN
star.js/themes/inversed/tex_ball_selected.png
Normal file
After Width: | Height: | Size: 510 B |
BIN
star.js/themes/inversed/tex_cube.png
Normal file
After Width: | Height: | Size: 167 B |
BIN
star.js/themes/inversed/tex_cube_selected.png
Normal file
After Width: | Height: | Size: 223 B |
BIN
star.js/themes/inversed/tex_empty.png
Normal file
After Width: | Height: | Size: 149 B |
BIN
star.js/themes/inversed/tex_gift.png
Normal file
After Width: | Height: | Size: 454 B |
BIN
star.js/themes/inversed/tex_wall.png
Normal file
After Width: | Height: | Size: 544 B |