
previous

page 7
next
To further simplify our work, we're going to create a set_scene function which will take the scene number as input. So for the previous page you would simply have added the following to your index.html.
<script>
set_scene(16);
</script>
</body>
set_scene(16);
</script>
</body>
See how far you can get before looking at my work.
My index.html
<html>
<head>
<title>Rainbow</title>
<link rel='stylesheet' href='styles.css'>
<script src='library.js'></script>
<script src='set_scene.js'></script>
</head>
<body>
<div id='game'>
<img src='images/scenes/3.jpg' id='scene'>
<img src='images/shapes/blue.png' id='blue' class='item'>
<img src='images/shapes/green.png' id='green' class='item'>
</div>
<script>
set_scene(16);
</script>
</body>
</html>
<head>
<title>Rainbow</title>
<link rel='stylesheet' href='styles.css'>
<script src='library.js'></script>
<script src='set_scene.js'></script>
</head>
<body>
<div id='game'>
<img src='images/scenes/3.jpg' id='scene'>
<img src='images/shapes/blue.png' id='blue' class='item'>
<img src='images/shapes/green.png' id='green' class='item'>
</div>
<script>
set_scene(16);
</script>
</body>
</html>
previous
next