mirror of
https://github.com/gwenhael-le-moine/c-urs_-toil-s.git
synced 2024-12-27 09:58:44 +01:00
add optional level_index parameter
This commit is contained in:
parent
396cefca7d
commit
2bd110a87b
2 changed files with 6 additions and 3 deletions
|
@ -51,7 +51,7 @@
|
||||||
<script src="js/star.js"></script>
|
<script src="js/star.js"></script>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
initialize_a_star( "#main" );
|
initialize_a_star( "#main", 0 );
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
function initialize_a_star( dom_container ) {
|
function initialize_a_star( dom_container, level_index ) {
|
||||||
// kinda enums
|
// kinda enums
|
||||||
var cell= { WALL: '#', BALL: '@', CUBE: 'H', VOID: ' ', GIFT: 'x' };
|
var cell= { WALL: '#', BALL: '@', CUBE: 'H', VOID: ' ', GIFT: 'x' };
|
||||||
var direction = { UP: 'u', DOWN: 'd', LEFT: 'l', RIGHT: 'r' };
|
var direction = { UP: 'u', DOWN: 'd', LEFT: 'l', RIGHT: 'r' };
|
||||||
|
@ -329,7 +329,10 @@ function initialize_a_star( dom_container ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
////// MAIN (so to speak) //////
|
////// MAIN (so to speak) //////
|
||||||
state = load_level( 0 );
|
state = load_level( ( level_index === undefined ) ? 0 :
|
||||||
|
( level_index >= assets.levels.length ) ? assets.levels.length - 1 :
|
||||||
|
( level_index < 0 ) ? 0 : level_index
|
||||||
|
);
|
||||||
|
|
||||||
start_loop( );
|
start_loop( );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue